func (HMACSHA1) Signature(
	ssodata *SSOData, rp *RequestParameters) (string, error) {
	baseUrl, err := NormalizeURL(rp.BaseURL)
	if err != nil {
		return "", err
	}
	query := url.Values{}
	for k, v := range rp.Params {
		query[k] = v
	}
	query.Set("oauth_consumer_key", ssodata.ConsumerKey)
	query.Set("oauth_nonce", rp.Nonce)
	query.Set("oauth_signature_method", string(rp.SignatureMethod.Name()))
	query.Set("oauth_timestamp", rp.Timestamp)
	query.Set("oauth_token", ssodata.TokenKey)
	query.Set("oauth_version", "1.0")
	params, err := NormalizeParameters(query)
	if err != nil {
		return "", err
	}
	baseString := fmt.Sprintf("%s&%s&%s",
		rp.HTTPMethod,
		escape(baseUrl),
		escape(params),
	)
	hashfun := hmac.New(sha1.New, []byte(
		ssodata.ConsumerSecret+"&"+ssodata.TokenSecret))
	hashfun.Write([]byte(baseString))
	rawsignature := hashfun.Sum(nil)
	base64signature := make(
		[]byte, base64.StdEncoding.EncodedLen(len(rawsignature)))
	base64.StdEncoding.Encode(base64signature, rawsignature)
	return string(base64signature), nil
}
// Calculate the oaut_signature part of the Authentication Header.
Calculate the oaut_signature part of the Authentication Header.
// Calculate the oaut_signature part of the Authentication Header .
func (HMACSHA1) Signature(
	ssodata *SSOData, rp *RequestParameters) (string, error) {
	baseUrl, err := NormalizeURL(rp.BaseURL)
	if err != nil {
		return "", err
	}
	query := url.Values{}
	for k, v := range rp.Params {
		query[k] = v
	}
	query.Set("oauth_consumer_key", ssodata.ConsumerKey)
	query.Set("oauth_nonce", rp.Nonce)
	query.Set("oauth_signature_method", string(rp.SignatureMethod.Name()))
	query.Set("oauth_timestamp", rp.Timestamp)
	query.Set("oauth_token", ssodata.TokenKey)
	query.Set("oauth_version", "1.0")
	params, err := NormalizeParameters(query)
	if err != nil {
		return "", err
	}
	baseString := fmt.Sprintf("%s&%s&%s",
		rp.HTTPMethod,
		escape(baseUrl),
		escape(params),
	)
	hashfun := hmac.New(sha1.New, []byte(
		ssodata.ConsumerSecret+"&"+ssodata.TokenSecret))
	hashfun.Write([]byte(baseString))
	rawsignature := hashfun.Sum(nil)
	base64signature := make(
		[]byte, base64.StdEncoding.EncodedLen(len(rawsignature)))
	base64.StdEncoding.Encode(base64signature, rawsignature)
	return string(base64signature), nil
}
func ( HMACSHA1 ) Signature ( ssodata * SSOData , rp * RequestParameters ) ( string , error ) { baseUrl , err := NormalizeURL ( rp . BaseURL ) if err != nil { return " " , err } query := url . Values { } for k , v := range rp . Params { query [ k ] = v } query . Set ( " " , ssodata . ConsumerKey ) query . Set ( " " , rp . Nonce ) query . Set ( " " , string ( rp . SignatureMethod . Name ( ) ) ) query . Set ( " " , rp . Timestamp ) query . Set ( " " , ssodata . TokenKey ) query . Set ( " " , " " ) params , err := NormalizeParameters ( query ) if err != nil { return " " , err } baseString := fmt . Sprintf ( " " , rp . HTTPMethod , escape ( baseUrl ) , escape ( params ) , ) hashfun := hmac . New ( sha1 . New , [ ] byte ( ssodata . ConsumerSecret + " " + ssodata . TokenSecret ) ) hashfun . Write ( [ ] byte ( baseString ) ) rawsignature := hashfun . Sum ( nil ) base64signature := make ( [ ] byte , base64 . StdEncoding . EncodedLen ( len ( rawsignature ) ) ) base64 . StdEncoding . Encode ( base64signature , rawsignature ) return string ( base64signature ) , nil }
Calculate the oaut_signature part of the Authentication Header.
Calculate the oaut_signature part of the Authentication Header .