Versions in this module Expand all Collapse all v0 v0.1.0 Feb 3, 2018 Changes in this version + const OAuthSecretBytes + var ErrInternal = errors.New("OAuth internal error") + func BindOauthContext(oc *Controller) func(ctx *APICtx, rw web.ResponseWriter, req *web.Request, ...) + func NewAccessTokenWrap(i interface{}) interface + func NewAuthorizeCodeWrap(i interface{}) fosite.Requester + func NewClientWrapper(c interface{}) fosite.Client + func NewRefreshTokenWrap(i interface{}) interface + func NewSessionWrap(s interface{}) fosite.Session + func PackRequest(req *fosite.Request) (string, error) + func UnpackRequest(data string) (fosite.Request, error) + type APICtx struct + func (c *APICtx) AccessTokenInfoGet(rw web.ResponseWriter, req *web.Request) + func (c *APICtx) AuthorizeConfirmPost(rw web.ResponseWriter, req *web.Request) + func (c *APICtx) AuthorizePendingGet(rw web.ResponseWriter, req *web.Request) + func (c *APICtx) AuthorizeRequestGet(rw web.ResponseWriter, req *web.Request) + func (c *APICtx) ClientsGet(rw web.ResponseWriter, req *web.Request) + func (c *APICtx) ClientsPost(rw web.ResponseWriter, req *web.Request) + func (c *APICtx) IntrospectPost(rw web.ResponseWriter, req *web.Request) + func (c *APICtx) OptionsGet(rw web.ResponseWriter, req *web.Request) + func (c *APICtx) SessionsInfoGet(rw web.ResponseWriter, req *web.Request) + func (c *APICtx) TokenPost(rw web.ResponseWriter, req *web.Request) + type AccessTokenInfo struct + ExpiresAt time.Time + RequestedAt time.Time + type AccessTokenSession interface + GetSignature func() string + type AccessTokenWrap struct + func (s *AccessTokenWrap) GetClient() fosite.Client + func (s *AccessTokenWrap) GetGrantedScopes() fosite.Arguments + func (s *AccessTokenWrap) GetID() string + func (s *AccessTokenWrap) GetRequestForm() url.Values + func (s *AccessTokenWrap) GetRequestedScopes() fosite.Arguments + func (s *AccessTokenWrap) GetSession() fosite.Session + func (s *AccessTokenWrap) Merge(requester fosite.Requester) + func (s *AccessTokenWrap) SetRequestedScopes(scopes fosite.Arguments) + func (s *AccessTokenWrap) SetSession(session fosite.Session) + type AuthorizationRequest struct + Name string + RedirectURI string + Scopes []string + State string + type AuthorizeCodeSession interface + GetCode func() string + type AuthorizeCodeWrap struct + func (s *AuthorizeCodeWrap) GetClient() fosite.Client + func (s *AuthorizeCodeWrap) GetGrantedScopes() fosite.Arguments + func (s *AuthorizeCodeWrap) GetID() string + func (s *AuthorizeCodeWrap) GetRequestForm() url.Values + func (s *AuthorizeCodeWrap) GetRequestedScopes() fosite.Arguments + func (s *AuthorizeCodeWrap) GetSession() fosite.Session + func (s *AuthorizeCodeWrap) Merge(requester fosite.Requester) + func (s *AuthorizeCodeWrap) SetID(id string) + func (s *AuthorizeCodeWrap) SetRequestedScopes(scopes fosite.Arguments) + func (s *AuthorizeCodeWrap) SetSession(session fosite.Session) + type AuthorizeConfirm struct + Accept bool + GrantedScopes []string + State string + type Client interface + GetCreatedAt func() time.Time + GetGrantTypes func() []string + GetID func() string + GetLastUsed func() time.Time + GetName func() string + GetRedirectURIs func() []string + GetResponseTypes func() []string + GetScopes func() []string + GetSecret func() string + GetUserData func() interface{} + IsPublic func() bool + SetLastUsed func(time.Time) + type ClientReq struct + Grants []string + Name string + Redirects []string + Responses []string + Scopes []string + type ClientResp struct + ClientID string + CreatedAt time.Time + GrantTypes []string + LastUsed time.Time + Name string + RedirectURIs []string + ResponseTypes []string + Scopes []string + Secret string + type ClientWrapper struct + func (c ClientWrapper) GetGrantTypes() fosite.Arguments + func (c ClientWrapper) GetHashedSecret() []byte + func (c ClientWrapper) GetRedirectURIs() []string + func (c ClientWrapper) GetResponseTypes() fosite.Arguments + func (c ClientWrapper) GetScopes() fosite.Arguments + type Controller struct + OAuth2 fosite.OAuth2Provider + func NewController(store Storer, config config.OAuthConfig) *Controller + func (oc *Controller) BindAPI(base *web.Router) *web.Router + func (oc *Controller) CreateClient(userID, clientName string, ...) (*ClientResp, error) + func (oc *Controller) GetAccessTokenInfo(tokenString string) (*AccessTokenInfo, error) + func (oc *Controller) GetClients(userID string) ([]ClientResp, error) + func (oc *Controller) GetOptions(userID string) (*OptionResp, error) + func (oc *Controller) GetUserSessions(userID string) (*UserSessions, error) + func (oc *Controller) RemoveClient(clientID string) error + func (oc *Controller) UpdateClient(client Client) error + type FositeAdaptor struct + Storer Storer + func NewAdaptor(s Storer) *FositeAdaptor + func (oa *FositeAdaptor) CreateAccessTokenSession(c context.Context, signature string, request fosite.Requester) (err error) + func (oa *FositeAdaptor) CreateAuthorizeCodeSession(ctx context.Context, code string, request fosite.Requester) (err error) + func (oa *FositeAdaptor) CreateRefreshTokenSession(ctx context.Context, signature string, request fosite.Requester) (err error) + func (oa *FositeAdaptor) DeleteAccessTokenSession(ctx context.Context, signature string) (err error) + func (oa *FositeAdaptor) DeleteAuthorizeCodeSession(ctx context.Context, code string) (err error) + func (oa *FositeAdaptor) DeleteRefreshTokenSession(ctx context.Context, signature string) (err error) + func (oa *FositeAdaptor) GetAccessTokenSession(ctx context.Context, signature string, session fosite.Session) (request fosite.Requester, err error) + func (oa *FositeAdaptor) GetAuthorizeCodeSession(ctx context.Context, code string, session fosite.Session) (request fosite.Requester, err error) + func (oa *FositeAdaptor) GetClient(ctx context.Context, id string) (fosite.Client, error) + func (oa *FositeAdaptor) GetRefreshTokenSession(ctx context.Context, signature string, session fosite.Session) (request fosite.Requester, err error) + func (oa *FositeAdaptor) PersistAuthorizeCodeGrantSession(ctx context.Context, authorizeCode, accessSignature, refreshSignature string, ...) error + func (oa *FositeAdaptor) PersistRefreshTokenGrantSession(ctx context.Context, ...) error + func (oa *FositeAdaptor) RevokeAccessToken(ctx context.Context, requestID string) error + func (oa *FositeAdaptor) RevokeRefreshToken(ctx context.Context, requestID string) error + type GrantInfo struct + ExpiresAt time.Time + ID string + RequestedAt time.Time + Scopes []string + Type string + type OptionResp struct + GrantTypes []string + ResponseTypes []string + Scopes []string + type RefreshTokenSession interface + GetSignature func() string + type RefreshTokenWrap struct + func (s *RefreshTokenWrap) GetClient() fosite.Client + func (s *RefreshTokenWrap) GetGrantedScopes() fosite.Arguments + func (s *RefreshTokenWrap) GetID() string + func (s *RefreshTokenWrap) GetRequestForm() url.Values + func (s *RefreshTokenWrap) GetRequestedScopes() fosite.Arguments + func (s *RefreshTokenWrap) GetSession() fosite.Session + func (s *RefreshTokenWrap) Merge(requester fosite.Requester) + func (s *RefreshTokenWrap) SetRequestedScopes(scopes fosite.Arguments) + func (s *RefreshTokenWrap) SetSession(session fosite.Session) + type Session struct + AccessExpiry time.Time + AuthorizeExpiry time.Time + IDExpiry time.Time + RefreshExpiry time.Time + Subject string + UserID string + Username string + func NewSession(userID, username string) *Session + func (s *Session) Clone() interface{} + func (s *Session) GetAccessExpiry() time.Time + func (s *Session) GetAuthorizeExpiry() time.Time + func (s *Session) GetIDExpiry() time.Time + func (s *Session) GetRefreshExpiry() time.Time + func (s *Session) GetSubject() string + func (s *Session) GetUserID() string + func (s *Session) GetUsername() string + func (s *Session) SetAccessExpiry(t time.Time) + func (s *Session) SetAuthorizeExpiry(t time.Time) + func (s *Session) SetIDExpiry(t time.Time) + func (s *Session) SetRefreshExpiry(t time.Time) + type SessionBase interface + AppendRequestedScope func(scope string) + GetClient func() interface{} + GetExpiresAt func() time.Time + GetGrantedScopes func() []string + GetRequestID func() string + GetRequestedAt func() time.Time + GetRequestedScopes func() []string + GetSession func() interface{} + GetUserID func() string + GrantScope func(scope string) + Merge func(interface{}) + SetRequestID func(string) + SetRequestedScopes func(scopes []string) + SetSession func(session interface{}) + type SessionWrap struct + func (s *SessionWrap) Clone() fosite.Session + func (s *SessionWrap) GetSubject() string + func (s *SessionWrap) GetUsername() string + func (session *SessionWrap) GetExpiresAt(key fosite.TokenType) time.Time + func (session *SessionWrap) SetExpiresAt(key fosite.TokenType, exp time.Time) + type Storer interface + AddAccessTokenSession func(userID, clientID, signature, requestID string, ...) (interface{}, error) + AddAuthorizeCodeSession func(userID, clientID, code, requestID string, requestedAt, expiresAt time.Time, ...) (interface{}, error) + AddClient func(userID, clientID, clientName, secret string, ...) (interface{}, error) + AddRefreshTokenSession func(userID, clientID, signature, requestID string, ...) (interface{}, error) + GetAccessTokenSession func(sgnature string) (interface{}, error) + GetAccessTokenSessionByRequestID func(requestID string) (interface{}, error) + GetAccessTokenSessionsByUserID func(userID string) ([]interface{}, error) + GetAuthorizeCodeSession func(code string) (interface{}, error) + GetAuthorizeCodeSessionByRequestID func(requestID string) (interface{}, error) + GetAuthorizeCodeSessionsByUserID func(userID string) ([]interface{}, error) + GetClientByAccessTokenSession func(token string) (interface{}, error) + GetClientByID func(clientID string) (interface{}, error) + GetClientsByUserID func(userID string) ([]interface{}, error) + GetRefreshTokenBySignature func(signature string) (interface{}, error) + GetRefreshTokenSessionByRequestID func(requestID string) (interface{}, error) + GetRefreshTokenSessionsByUserID func(userID string) ([]interface{}, error) + GetUserByExtID func(userid string) (interface{}, error) + RemoveAccessTokenSession func(token string) error + RemoveAuthorizeCodeSession func(code string) error + RemoveClientByID func(clientID string) error + RemoveRefreshToken func(signature string) error + UpdateClient func(client interface{}) (interface{}, error) + type User interface + GetExtID func() string + IsAdmin func() bool + type UserSession interface + Clone func() interface{} + GetAccessExpiry func() time.Time + GetAuthorizeExpiry func() time.Time + GetIDExpiry func() time.Time + GetRefreshExpiry func() time.Time + GetSubject func() string + GetUserID func() string + GetUsername func() string + SetAccessExpiry func(time.Time) + SetAuthorizeExpiry func(time.Time) + SetIDExpiry func(time.Time) + SetRefreshExpiry func(time.Time) + type UserSessions struct + AccessCodes []GrantInfo + AuthorizationCodes []GrantInfo + RefreshTokens []GrantInfo