oauth2

package
v0.0.1-0...-6deec57 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitServer

func InitServer(
	cfg *config.Config,
	manager oauth2.Manager,
	clientRepository persistence.ClientRepository,
	timeout time.Duration,
) *oauth2server.Server

InitServer initialize the oauth2 server instance

func NewManager

func NewManager(tokenStore oauth2.TokenStore, clientStore oauth2.ClientStore, authenticator auth.Authenticator, clientRepository persistence.ClientRepository) oauth2.Manager

NewManager initialize the oauth2 manager service

Types

type JWTAccess

type JWTAccess struct {
	// contains filtered or unexported fields
}

JWTAccess generate the jwt access token

func NewJWTAccess

func NewJWTAccess(method jwt.SigningMethod, authenticator auth.Authenticator, clientRepository persistence.ClientRepository) *JWTAccess

NewJWTAccess create to generate the jwt access token instance

func (*JWTAccess) Token

func (a *JWTAccess) Token(ctx context.Context, data *oauth2.GenerateBasic, isGenRefresh bool) (string, string, error)

Token based on the UUID generated token

type JWTAccessClaims

type JWTAccessClaims struct {
	auth.Claims
}

JWTAccessClaims jwt claims

func (*JWTAccessClaims) Valid

func (c *JWTAccessClaims) Valid() error

Valid claims verification

type TokenStore

type TokenStore struct {
	// contains filtered or unexported fields
}

TokenStore token storage

func NewTokenStore

func NewTokenStore(persistenceRepository persistence.TokenRepository, eventSourcedRepository token.Repository) *TokenStore

NewTokenStore create a token store instance

func (*TokenStore) Create

func (ts *TokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error

Create create and store the new token information

func (*TokenStore) GetByAccess

func (ts *TokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)

GetByAccess use the access token for token information data

func (*TokenStore) GetByCode

func (ts *TokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)

GetByCode use the authorization code for token information data

func (*TokenStore) GetByRefresh

func (ts *TokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)

GetByRefresh use the refresh token for token information data

func (*TokenStore) RemoveByAccess

func (ts *TokenStore) RemoveByAccess(ctx context.Context, access string) error

RemoveByAccess use the access token to delete the token information

func (*TokenStore) RemoveByCode

func (ts *TokenStore) RemoveByCode(ctx context.Context, code string) error

RemoveByCode use the authorization code to delete the token information

func (*TokenStore) RemoveByRefresh

func (ts *TokenStore) RemoveByRefresh(ctx context.Context, refresh string) error

RemoveByRefresh use the refresh token to delete the token information

Jump to

Keyboard shortcuts

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