go-api-boilerplate: github.com/vardius/go-api-boilerplate/cmd/auth/internal/application/oauth2 Index | Files

package oauth2

import "github.com/vardius/go-api-boilerplate/cmd/auth/internal/application/oauth2"


Package Files

client_store.go jwt_access.go manager.go server.go token_store.go

func InitServer Uses

func InitServer(manager oauth2.Manager, db *sql.DB, logger *log.Logger, secretKey string, timeout time.Duration) *oauth2server.Server

InitServer initialize the oauth2 server instance

func NewManager Uses

func NewManager(tokenStore oauth2.TokenStore, clientStore oauth2.ClientStore, authenticator auth.Authenticator, repository userpersistence.UserRepository) oauth2.Manager

NewManager initialize the oauth2 manager service

type ClientStore Uses

type ClientStore struct {
    // contains filtered or unexported fields

ClientStore client information store

func NewClientStore Uses

func NewClientStore(repository persistence.ClientRepository) *ClientStore

NewClientStore create client store

func (*ClientStore) GetByID Uses

func (cs *ClientStore) GetByID(ctx context.Context, id string) (oauth2.ClientInfo, error)

GetByID according to the ID for the client information

func (*ClientStore) Internal Uses

func (cs *ClientStore) Internal(id string) (cli oauth2.ClientInfo, err error)

Internal according to the ID for the pkg client information

func (*ClientStore) SetInternal Uses

func (cs *ClientStore) SetInternal(id string, cli oauth2.ClientInfo) (err error)

SetInternal set pkg system client information

type JWTAccess Uses

type JWTAccess struct {
    // contains filtered or unexported fields

JWTAccess generate the jwt access token

func NewJWTAccess Uses

func NewJWTAccess(method jwt.SigningMethod, authenticator auth.Authenticator, repository userpersistence.UserRepository) *JWTAccess

NewJWTAccess create to generate the jwt access token instance

func (*JWTAccess) Token Uses

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

Token based on the UUID generated token

type JWTAccessClaims Uses

type JWTAccessClaims struct {

JWTAccessClaims jwt claims

func (*JWTAccessClaims) Valid Uses

func (c *JWTAccessClaims) Valid() error

Valid claims verification

type TokenStore Uses

type TokenStore struct {
    // contains filtered or unexported fields

TokenStore token storage

func NewTokenStore Uses

func NewTokenStore(r persistence.TokenRepository, cb commandbus.CommandBus) *TokenStore

NewTokenStore create a token store instance

func (*TokenStore) Create Uses

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

Create create and store the new token information

func (*TokenStore) GetByAccess Uses

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

GetByAccess use the access token for token information data

func (*TokenStore) GetByCode Uses

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

GetByCode use the authorization code for token information data

func (*TokenStore) GetByRefresh Uses

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

GetByRefresh use the refresh token for token information data

func (*TokenStore) RemoveByAccess Uses

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

RemoveByAccess use the access token to delete the token information

func (*TokenStore) RemoveByCode Uses

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

RemoveByCode use the authorization code to delete the token information

func (*TokenStore) RemoveByRefresh Uses

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

RemoveByRefresh use the refresh token to delete the token information

Package oauth2 imports 24 packages (graph) and is imported by 1 packages. Updated 2020-08-04. Refresh now. Tools for package owners.