Documentation ¶
Index ¶
- type Manager
- type MongoManager
- func (m *MongoManager) Authenticate(ctx context.Context, username string, secret string) (err error)
- func (m *MongoManager) CreateAccessTokenSession(_ context.Context, signature string, request fosite.Requester) (err error)
- func (m *MongoManager) CreateAuthorizeCodeSession(_ context.Context, code string, request fosite.Requester) (err error)
- func (m *MongoManager) CreateImplicitAccessTokenSession(ctx context.Context, token string, request fosite.Requester) (err error)
- func (m *MongoManager) CreateOpenIDConnectSession(ctx context.Context, authorizeCode string, requester fosite.Requester) (err error)
- func (m *MongoManager) CreateRefreshTokenSession(_ context.Context, signature string, request fosite.Requester) (err error)
- func (m *MongoManager) DeleteAccessTokenSession(_ context.Context, signature string) (err error)
- func (m *MongoManager) DeleteAuthorizeCodeSession(_ context.Context, code string) (err error)
- func (m *MongoManager) DeleteOpenIDConnectSession(ctx context.Context, authorizeCode string) (err error)
- func (m *MongoManager) DeleteRefreshTokenSession(_ context.Context, signature string) (err error)
- func (m MongoManager) GetAccessTokenSession(_ context.Context, signature string, session fosite.Session) (request fosite.Requester, err error)
- func (m MongoManager) GetAuthorizeCodeSession(_ context.Context, code string, session fosite.Session) (request fosite.Requester, err error)
- func (m *MongoManager) GetOpenIDConnectSession(ctx context.Context, authorizeCode string, requester fosite.Requester) (req fosite.Requester, err error)
- func (m *MongoManager) GetRefreshTokenSession(_ context.Context, signature string, session fosite.Session) (request fosite.Requester, err error)
- func (m *MongoManager) PersistAuthorizeCodeGrantSession(ctx context.Context, authorizeCode, accessSignature, refreshSignature string, ...) error
- func (m *MongoManager) PersistRefreshTokenGrantSession(ctx context.Context, ...) (err error)
- func (m *MongoManager) RevokeAccessToken(ctx context.Context, requestID string) error
- func (m *MongoManager) RevokeRefreshToken(ctx context.Context, requestID string) error
- type MongoRequest
- type Storer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { Storer }
Manager provides a generic interface to clients in order to build a DataStore
type MongoManager ¶
type MongoManager struct { // DB is the Mongo connection that holds the base session that can be copied and closed. DB *mgo.Database // In order to create, read, update and delete from the caching database, a CacheManager is required. Cache *cache.MongoManager // Due to the nature of an OAuth request, it will need to cross reference the Client collections. Clients *client.MongoManager // For the Password Credentials Grant, A user MongoManager is required in order to find and authenticate users. Users *user.MongoManager }
MongoManager manages the main Mongo Session for a Request.
func (*MongoManager) Authenticate ¶
func (m *MongoManager) Authenticate(ctx context.Context, username string, secret string) (err error)
Authenticate checks if supplied credentials are valid
func (*MongoManager) CreateAccessTokenSession ¶
func (m *MongoManager) CreateAccessTokenSession(_ context.Context, signature string, request fosite.Requester) (err error)
CreateAccessTokenSession creates a new session for an Access Token in mongo
func (*MongoManager) CreateAuthorizeCodeSession ¶
func (m *MongoManager) CreateAuthorizeCodeSession(_ context.Context, code string, request fosite.Requester) (err error)
CreateAuthorizeCodeSession creates a new session for an authorize code grant in mongo
func (*MongoManager) CreateImplicitAccessTokenSession ¶
func (m *MongoManager) CreateImplicitAccessTokenSession(ctx context.Context, token string, request fosite.Requester) (err error)
CreateImplicitAccessTokenSession stores an implicit access token based session in mongo
func (*MongoManager) CreateOpenIDConnectSession ¶
func (m *MongoManager) CreateOpenIDConnectSession(ctx context.Context, authorizeCode string, requester fosite.Requester) (err error)
CreateOpenIDConnectSession creates an open id connect session for a given authorize code in mongo. This is relevant for explicit open id connect flow.
func (*MongoManager) CreateRefreshTokenSession ¶
func (m *MongoManager) CreateRefreshTokenSession(_ context.Context, signature string, request fosite.Requester) (err error)
CreateRefreshTokenSession stores a new Refresh Token Session in mongo
func (*MongoManager) DeleteAccessTokenSession ¶
func (m *MongoManager) DeleteAccessTokenSession(_ context.Context, signature string) (err error)
DeleteAccessTokenSession removes an Access Tokens current session from mongo
func (*MongoManager) DeleteAuthorizeCodeSession ¶
func (m *MongoManager) DeleteAuthorizeCodeSession(_ context.Context, code string) (err error)
DeleteAuthorizeCodeSession removes an authorize code session from mongo
func (*MongoManager) DeleteOpenIDConnectSession ¶
func (m *MongoManager) DeleteOpenIDConnectSession(ctx context.Context, authorizeCode string) (err error)
DeleteOpenIDConnectSession removes an open id connect session from mongo.
func (*MongoManager) DeleteRefreshTokenSession ¶
func (m *MongoManager) DeleteRefreshTokenSession(_ context.Context, signature string) (err error)
DeleteRefreshTokenSession removes a Refresh Token that has been previously stored in mongo
func (MongoManager) GetAccessTokenSession ¶
func (m MongoManager) GetAccessTokenSession(_ context.Context, signature string, session fosite.Session) (request fosite.Requester, err error)
GetAccessTokenSession returns a session if it can be found by signature in mongo
func (MongoManager) GetAuthorizeCodeSession ¶
func (m MongoManager) GetAuthorizeCodeSession(_ context.Context, code string, session fosite.Session) (request fosite.Requester, err error)
GetAuthorizeCodeSession finds an authorize code grant session in mongo
func (*MongoManager) GetOpenIDConnectSession ¶
func (m *MongoManager) GetOpenIDConnectSession(ctx context.Context, authorizeCode string, requester fosite.Requester) (req fosite.Requester, err error)
GetOpenIDConnectSession gets a session based off the Authorize Code and returns a fosite.Requester which contains a session or an error.
func (*MongoManager) GetRefreshTokenSession ¶
func (m *MongoManager) GetRefreshTokenSession(_ context.Context, signature string, session fosite.Session) (request fosite.Requester, err error)
GetRefreshTokenSession returns a Refresh Token Session that's been previously stored in mongo
func (*MongoManager) PersistAuthorizeCodeGrantSession ¶
func (m *MongoManager) PersistAuthorizeCodeGrantSession(ctx context.Context, authorizeCode, accessSignature, refreshSignature string, request fosite.Requester) error
PersistAuthorizeCodeGrantSession creates an Authorise Code Grant session in mongo
func (*MongoManager) PersistRefreshTokenGrantSession ¶
func (m *MongoManager) PersistRefreshTokenGrantSession(ctx context.Context, requestRefreshSignature, accessSignature, refreshSignature string, request fosite.Requester) (err error)
PersistRefreshTokenGrantSession stores a refresh token grant session in mongo
func (*MongoManager) RevokeAccessToken ¶
func (m *MongoManager) RevokeAccessToken(ctx context.Context, requestID string) error
RevokeAccessToken finds a token stored in cache based on request ID and deletes the session by signature.
func (*MongoManager) RevokeRefreshToken ¶
func (m *MongoManager) RevokeRefreshToken(ctx context.Context, requestID string) error
RevokeRefreshToken finds a token stored in cache based on request ID and deletes the session by signature.
type MongoRequest ¶
type MongoRequest struct { ID string `bson:"_id" json:"id" xml:"id"` RequestedAt time.Time `bson:"requestedAt" json:"requestedAt" xml:"requestedAt"` Signature string `bson:"signature" json:"signature" xml:"signature"` ClientID string `bson:"clientId" json:"clientId" xml:"clientId"` Scopes []string `bson:"scopes" json:"scopes" xml:"scopes"` GrantedScopes []string `bson:"grantedScopes" json:"grantedScopes" xml:"grantedScopes"` Form string `bson:"formData" json:"formData" xml:"formData"` Session []byte `bson:"sessionData" json:"sessionData" xml:"sessionData"` }
MongoRequest is a concrete implementation of a fosite.Requester, extended to support the required data for OAuth2 and OpenID.
func NewRequest ¶
func NewRequest() *MongoRequest
type Storer ¶
type Storer interface { fosite.Requester // OAuth2 Required Storage interfaces. oauth2.AuthorizeCodeGrantStorage oauth2.ClientCredentialsGrantStorage oauth2.ImplicitGrantStorage oauth2.RefreshTokenGrantStorage // Authenticate is required to implement the oauth2.ResourceOwnerPasswordCredentialsGrantStorage interface Authenticate(ctx context.Context, name string, secret string) error // OpenID Required Storage Interfaces openid.OpenIDConnectRequestStorage }
Storer conforms to fosite.Requester and provides methods
Source Files ¶
- request_manager.go
- request_manager_mongo.go
- request_mongo.go
- request_oauth2_access_token_storage.go
- request_oauth2_authorize_code_grant_storage.go
- request_oauth2_authorize_code_storage.go
- request_oauth2_client_credentials_grant_storage.go
- request_oauth2_implicit_grant_storage.go
- request_oauth2_refresh_token_grant_storage.go
- request_oauth2_refresh_token_storage.go
- request_oauth2_resource_owner_password_credentials_grant_storage.go
- request_openid_open_id_connect_request_storage.go
- request_requester.go