Documentation
¶
Index ¶
- Variables
- func GetAuthorizationHeader(ssodata *SSOData, rp *RequestParameters) (string, error)
- func NormalizeParameters(parameters url.Values) (string, error)
- func NormalizeURL(inputUrl string) (string, error)
- func SignRequest(ssodata *SSOData, rp *RequestParameters, request *http.Request) error
- type HMACSHA1
- type PLAINTEXT
- type RequestParameters
- type SSOData
- type SignatureMethod
- type UbuntuSSOServer
- func (server UbuntuSSOServer) AccountsURL() string
- func (server UbuntuSSOServer) GetAccounts(ssodata *SSOData) (string, error)
- func (server UbuntuSSOServer) GetToken(email string, password string, tokenName string) (*SSOData, error)
- func (server UbuntuSSOServer) GetTokenDetails(ssodata *SSOData) (string, error)
- func (server UbuntuSSOServer) IsTokenValid(ssodata *SSOData) (bool, error)
- func (server UbuntuSSOServer) LoginURL() string
- func (server UbuntuSSOServer) TokenDetailsURL() string
Constants ¶
This section is empty.
Variables ¶
var ProductionUbuntuSSOServer = UbuntuSSOServer{"https://login.ubuntu.com", "https://one.ubuntu.com/oauth/sso-finished-so-get-tokens/"}
ProductionUbuntuSSOServer represents the production Ubuntu SSO server located at https://login.ubuntu.com.
var StagingUbuntuSSOServer = UbuntuSSOServer{"https://login.staging.ubuntu.com", "https://one.staging.ubuntu.com/oauth/sso-finished-so-get-tokens/"}
StagingUbuntuSSOServer represents the staging Ubuntu SSO server located at https://login.staging.ubuntu.com. Use it for testing.
Functions ¶
func GetAuthorizationHeader ¶
func GetAuthorizationHeader( ssodata *SSOData, rp *RequestParameters) (string, error)
Given oauth credentials return a valid http authorization header.
func NormalizeParameters ¶
Normalize the parameters in the query string according to OAuth specs. url.Values.Encode encoded the GET parameters in a consistent order we do the encoding ourselves.
func NormalizeURL ¶
Normalize the URL according to OAuth specs.
Types ¶
type HMACSHA1 ¶
type HMACSHA1 struct{}
func (HMACSHA1) Name ¶
Return the name of the signature method, used to compose the Authentication Header.
type PLAINTEXT ¶
type PLAINTEXT struct{}
func (PLAINTEXT) Name ¶
Return the name of the signature method, used to compose the Authentication Header.
type RequestParameters ¶
type SSOData ¶
type SSOData struct {
ConsumerKey string `json:"consumer_key"`
ConsumerSecret string `json:"consumer_secret"`
Realm string `json:"realm"`
TokenKey string `json:"token_key"`
TokenName string `json:"token_name"`
TokenSecret string `json:"token_secret"`
}
Contains the oauth data to perform a request.
func (*SSOData) GetAuthorizationHeader ¶
func (ssodata *SSOData) GetAuthorizationHeader( rp *RequestParameters) (string, error)
Sign the provided request.
type SignatureMethod ¶
type SignatureMethod interface {
Name() string
Signature(
ssodata *SSOData, rp *RequestParameters) (string, error)
}
type UbuntuSSOServer ¶
type UbuntuSSOServer struct {
// contains filtered or unexported fields
}
func (UbuntuSSOServer) AccountsURL ¶
func (server UbuntuSSOServer) AccountsURL() string
AccountURL returns the URL where the Ubuntu SSO account information can be requested.
func (UbuntuSSOServer) GetAccounts ¶
func (server UbuntuSSOServer) GetAccounts(ssodata *SSOData) (string, error)
Returns all the Ubuntu SSO information related to this account.
func (UbuntuSSOServer) GetToken ¶
func (server UbuntuSSOServer) GetToken(email string, password string, tokenName string) (*SSOData, error)
Giving user credentials and token name, retrieves oauth credentials for the users, the oauth credentials can be used later to sign requests.
func (UbuntuSSOServer) GetTokenDetails ¶
func (server UbuntuSSOServer) GetTokenDetails(ssodata *SSOData) (string, error)
Returns all the Ubuntu SSO information related to this token.
func (UbuntuSSOServer) IsTokenValid ¶
func (server UbuntuSSOServer) IsTokenValid(ssodata *SSOData) (bool, error)
Verify the validity of the token, abusing the API to get the token details.
func (UbuntuSSOServer) LoginURL ¶
func (server UbuntuSSOServer) LoginURL() string
LoginURL returns the url for Openid login
func (UbuntuSSOServer) TokenDetailsURL ¶
func (server UbuntuSSOServer) TokenDetailsURL() string
TokenDetailURL returns the URL where the Ubuntu SSO token details can be requested.
Source Files
¶
- oauth.go
- url.go
- usso.go