Help us shape the future of Go! Take the 2026 Go Developer Survey

usso

package module
v0.0.0-...-0000000 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2014 License: GPL-3.0 Imports: 13 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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

func NormalizeParameters(parameters url.Values) (string, error)

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

func NormalizeURL(inputUrl string) (string, error)

Normalize the URL according to OAuth specs.

func SignRequest

func SignRequest(
	ssodata *SSOData, rp *RequestParameters, request *http.Request) error

Given oauth credentials and a request, return it signed.

Types

type HMACSHA1

type HMACSHA1 struct{}

func (HMACSHA1) Name

func (HMACSHA1) Name() string

Return the name of the signature method, used to compose the Authentication Header.

func (HMACSHA1) Signature

func (HMACSHA1) Signature(
	ssodata *SSOData, rp *RequestParameters) (string, error)

Calculate the oaut_signature part of the Authentication Header.

type PLAINTEXT

type PLAINTEXT struct{}

func (PLAINTEXT) Name

func (PLAINTEXT) Name() string

Return the name of the signature method, used to compose the Authentication Header.

func (PLAINTEXT) Signature

func (PLAINTEXT) Signature(
	ssodata *SSOData, rp *RequestParameters) (string, error)

Calculate the oaut_signature part of the Authentication Header.

type RequestParameters

type RequestParameters struct {
	HTTPMethod      string
	BaseURL         string
	Params          url.Values
	Nonce           string
	Timestamp       string
	SignatureMethod SignatureMethod
}

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.

func (*SSOData) SignRequest

func (ssodata *SSOData) SignRequest(
	rp *RequestParameters, req *http.Request) 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL