oauth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OAuth2InternalGrantFactory

func OAuth2InternalGrantFactory(config fosite.Configurator, storage interface{}, strategy interface{}) interface{}

OAuth2InternalGrantFactory creates an OAuth2 client credentials grant handler and registers an access token, refresh token and authorize code validator.

Types

type AuthTokens

type AuthTokens struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
}

type InternalGrantHandler

type InternalGrantHandler struct {
	*oauth2.HandleHelper
	RefreshTokenStrategy oauth2.RefreshTokenStrategy
	RefreshTokenStorage  oauth2.RefreshTokenStorage
	Config               interface {
		fosite.AccessTokenLifespanProvider
	}
}

func (InternalGrantHandler) CanHandleTokenEndpointRequest

func (InternalGrantHandler) CanHandleTokenEndpointRequest(ctx context.Context, request fosite.AccessRequester) bool

CanHandleRequest indicates, if TokenEndpointInternalGrantHandler can handle this request or not. If true, HandleTokenEndpointRequest can be called.

func (InternalGrantHandler) CanSkipClientAuth

func (InternalGrantHandler) CanSkipClientAuth(ctx context.Context, request fosite.AccessRequester) bool

CanSkipClientAuth indicates if client authentication can be skipped. By default it MUST be false, unless you are implementing extension grant type, which allows unauthenticated client. CanSkipClientAuth must be called before HandleTokenEndpointRequest to decide, if AccessRequester will contain authenticated client.

func (InternalGrantHandler) HandleTokenEndpointRequest

func (i InternalGrantHandler) HandleTokenEndpointRequest(ctx context.Context, request fosite.AccessRequester) error

HandleTokenEndpointRequest handles an authorize request. If the handler is not responsible for handling the request, this method should return ErrUnknownRequest and otherwise handle the request.

func (InternalGrantHandler) PopulateTokenEndpointResponse

func (i InternalGrantHandler) PopulateTokenEndpointResponse(ctx context.Context, request fosite.AccessRequester, responder fosite.AccessResponder) error

PopulateTokenEndpointResponse is responsible for setting return values and should only be executed if the handler's HandleTokenEndpointRequest did not return ErrUnknownRequest.

type UseCasesOauth

type UseCasesOauth interface {
	CreateOauthClient(ctx context.Context, input dto.OauthClientInput) (*domain.OauthClient, error)
	FositeProvider() fosite.OAuth2Provider
	GenerateUserAuthTokens(ctx context.Context, userID string) (*AuthTokens, error)
	RefreshAuthToken(ctx context.Context, refreshToken string) (*AuthTokens, error)
}

UseCasesCommunities holds all interfaces required to implement the communities feature

type UseCasesOauthImpl

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

UseCasesOauthImpl represents oauth implementation

func NewUseCasesOauthImplementation

func NewUseCasesOauthImplementation(create infrastructure.Create, update infrastructure.Update, query infrastructure.Query, delete infrastructure.Delete) UseCasesOauthImpl

NewUseCasesOauthImplementation initializes an implementation of the fosite storage

func (UseCasesOauthImpl) CreateOauthClient

func (u UseCasesOauthImpl) CreateOauthClient(ctx context.Context, input dto.OauthClientInput) (*domain.OauthClient, error)

CreateOauthClient is the resolver for the createOauthClient field.

func (UseCasesOauthImpl) FositeProvider

func (u UseCasesOauthImpl) FositeProvider() fosite.OAuth2Provider

func (UseCasesOauthImpl) GenerateUserAuthTokens

func (u UseCasesOauthImpl) GenerateUserAuthTokens(ctx context.Context, userID string) (*AuthTokens, error)

func (UseCasesOauthImpl) ListOauthClients

func (u UseCasesOauthImpl) ListOauthClients(ctx context.Context) ([]*domain.OauthClient, error)

ListOauthClients is the resolver for the listOauthClients field.

func (UseCasesOauthImpl) RefreshAuthToken

func (u UseCasesOauthImpl) RefreshAuthToken(ctx context.Context, refreshToken string) (*AuthTokens, error)

RefreshAuthToken is the resolver for the listOauthClients field.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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