Documentation ¶
Index ¶
- Constants
- Variables
- func AuthorizationCodeCommandTypes() []string
- func ClientApplicationCommandTypes() []string
- func GeneratePasswordHash(password string) string
- func RefreshTokenCommandTypes() []string
- func ResourceOwnerCommandTypes() []string
- func VerifyPassword(hash string, password string) bool
- type AccessTokenWasIssuedToClientApplicationViaClientCredentialsGrant
- type AccessTokenWasIssuedToUserViaAuthorizationCodeGrant
- type AccessTokenWasIssuedToUserViaImplicitGrant
- type AccessTokenWasIssuedToUserViaROPCGrant
- type AccessTokenWasIssuedToUserViaRefreshTokenGrant
- type AccessTokenWasRevokedDueToPreviouslyUsedRefreshToken
- type App
- type AuthorizationCodeRefreshTokens
- type AuthorizationCodeWasIssuedToUser
- type AuthorizationCodeWasIssuedToUserViaAuthorizationCodeGrant
- type AuthorizeUserToOnBoardClientApplications
- type AuthorizeUserToOnBoardClientApplicationsWasRejectedDueToMissingAuthorizingUser
- type AuthorizeUserToOnBoardClientApplicationsWasRejectedDueToMissingTargetUser
- type AuthorizeUserToOnBoardClientApplicationsWasRejectedDueToNonAdministrator
- type ClientApplicationWasOnBoarded
- type Command
- type CommandDispatcher
- type CommandHandler
- type CommandHandlerFactory
- type GrantUserAdministratorRole
- type GrantUserAdministratorRoleWasRejectedDueToMissingGrantingUser
- type GrantUserAdministratorRoleWasRejectedDueToMissingTargetUser
- type GrantUserAdministratorRoleWasRejectedDueToNonAdministrator
- type IssueAuthorizationCodeToUser
- type IssueRefreshTokenToUser
- type OnBoardClientApplication
- type OnBoardClientApplicationWasRejectedDueToInsecureRedirectURI
- type OnBoardClientApplicationWasRejectedDueToInvalidRedirectURI
- type OnBoardClientApplicationWasRejectedDueToUnAuthorizeUser
- type OnBoardUser
- type OnBoardUserWasRejectedDueToExistingUser
- type OnBoardUserWasRejectedDueToInsecurePassword
- type OnBoardUserWasRejectedDueToNonAdministrator
- type Option
- type PendingEvents
- type PreCommandHandler
- type RefreshTokenWasIssuedToUser
- type RefreshTokenWasIssuedToUserViaAuthorizationCodeGrant
- type RefreshTokenWasIssuedToUserViaROPCGrant
- type RefreshTokenWasIssuedToUserViaRefreshTokenGrant
- type RefreshTokenWasRevokedFromUser
- type RequestAccessTokenViaAuthorizationCodeGrant
- type RequestAccessTokenViaAuthorizationCodeGrantWasRejectedDueToExpiredAuthorizationCode
- type RequestAccessTokenViaAuthorizationCodeGrantWasRejectedDueToInvalidAuthorizationCode
- type RequestAccessTokenViaAuthorizationCodeGrantWasRejectedDueToInvalidClientApplicationID
- type RequestAccessTokenViaAuthorizationCodeGrantWasRejectedDueToInvalidClientApplicationRedirectURI
- type RequestAccessTokenViaAuthorizationCodeGrantWasRejectedDueToInvalidClientApplicationSecret
- type RequestAccessTokenViaAuthorizationCodeGrantWasRejectedDueToPreviouslyUsedAuthorizationCode
- type RequestAccessTokenViaAuthorizationCodeGrantWasRejectedDueToUnmatchedClientApplicationID
- type RequestAccessTokenViaClientCredentialsGrant
- type RequestAccessTokenViaClientCredentialsGrantWasRejectedDueToInvalidClientApplicationID
- type RequestAccessTokenViaClientCredentialsGrantWasRejectedDueToInvalidClientApplicationSecret
- type RequestAccessTokenViaImplicitGrant
- type RequestAccessTokenViaImplicitGrantWasRejectedDueToInvalidClientApplicationID
- type RequestAccessTokenViaImplicitGrantWasRejectedDueToInvalidClientApplicationRedirectURI
- type RequestAccessTokenViaImplicitGrantWasRejectedDueToInvalidUser
- type RequestAccessTokenViaImplicitGrantWasRejectedDueToInvalidUserPassword
- type RequestAccessTokenViaROPCGrant
- type RequestAccessTokenViaROPCGrantWasRejectedDueToInvalidClientApplicationCredentials
- type RequestAccessTokenViaROPCGrantWasRejectedDueToInvalidUser
- type RequestAccessTokenViaROPCGrantWasRejectedDueToInvalidUserPassword
- type RequestAccessTokenViaRefreshTokenGrant
- type RequestAccessTokenViaRefreshTokenGrantWasRejectedDueToInvalidClientApplicationCredentials
- type RequestAccessTokenViaRefreshTokenGrantWasRejectedDueToInvalidRefreshToken
- type RequestAccessTokenViaRefreshTokenGrantWasRejectedDueToInvalidScope
- type RequestAccessTokenViaRefreshTokenGrantWasRejectedDueToPreviouslyUsedRefreshToken
- type RequestAccessTokenViaRefreshTokenGrantWasRejectedDueToRevokedRefreshToken
- type RequestAuthorizationCodeViaAuthorizationCodeGrant
- type RequestAuthorizationCodeViaAuthorizationCodeGrantWasRejectedDueToInvalidClientApplicationID
- type RequestAuthorizationCodeViaAuthorizationCodeGrantWasRejectedDueToInvalidClientApplicationRedirectURI
- type RequestAuthorizationCodeViaAuthorizationCodeGrantWasRejectedDueToInvalidUser
- type RequestAuthorizationCodeViaAuthorizationCodeGrantWasRejectedDueToInvalidUserPassword
- type RevokeRefreshTokenFromUser
- type TokenGenerator
- type UserWasAuthorizedToOnBoardClientApplications
- type UserWasGrantedAdministratorRole
- type UserWasOnBoarded
Constants ¶
const Version = "0.1.0-dev"
Version for Go OAuth2.
Variables ¶
var ErrAuthorizationCodeNotFound = fmt.Errorf("authorization code not found")
ErrAuthorizationCodeNotFound is a defined error for missing authorization code.
Functions ¶
func AuthorizationCodeCommandTypes ¶
func AuthorizationCodeCommandTypes() []string
AuthorizationCodeCommandTypes returns all command types goauth2.authorizationCode supports.
func ClientApplicationCommandTypes ¶
func ClientApplicationCommandTypes() []string
ClientApplicationCommandTypes returns all command types goauth2.clientApplication supports.
func GeneratePasswordHash ¶
GeneratePasswordHash returns a password using bcrypt.GenerateFromPassword.
func RefreshTokenCommandTypes ¶
func RefreshTokenCommandTypes() []string
RefreshTokenCommandTypes returns all command types goauth2.refreshToken supports.
func ResourceOwnerCommandTypes ¶
func ResourceOwnerCommandTypes() []string
ResourceOwnerCommandTypes returns all command types goauth2.resourceOwner supports.
func VerifyPassword ¶
VerifyPassword verifies a password using bcrypt.CompareHashAndPassword.
Types ¶
type AccessTokenWasRevokedDueToPreviouslyUsedRefreshToken ¶
type AccessTokenWasRevokedDueToPreviouslyUsedRefreshToken struct {
RefreshToken string `json:"refreshToken"`
}
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the OAuth2 CQRS application.
func (*App) SubscribeAndReplay ¶
func (a *App) SubscribeAndReplay(subscribers ...rangedb.RecordSubscriber) error
SubscribeAndReplay subscribes and replays all events starting with zero.
type AuthorizationCodeRefreshTokens ¶
type AuthorizationCodeRefreshTokens struct {
// contains filtered or unexported fields
}
AuthorizationCodeRefreshTokens is a projection mapping authorization codes to refresh tokens.
func NewAuthorizationCodeRefreshTokens ¶
func NewAuthorizationCodeRefreshTokens() *AuthorizationCodeRefreshTokens
NewAuthorizationCodeRefreshTokens constructs an AuthorizationCodeRefreshTokens projection.
func (*AuthorizationCodeRefreshTokens) Accept ¶
func (a *AuthorizationCodeRefreshTokens) Accept(record *rangedb.Record)
Accept receives a rangedb.Record.
func (*AuthorizationCodeRefreshTokens) GetAuthorizationCode ¶
func (a *AuthorizationCodeRefreshTokens) GetAuthorizationCode(refreshToken string) (string, error)
GetAuthorizationCode returns a single authorization code from a refresh token.
func (*AuthorizationCodeRefreshTokens) GetTokens ¶
func (a *AuthorizationCodeRefreshTokens) GetTokens(authorizationCode string) []string
GetTokens returns all refresh tokens by authorizationCode.
type Command ¶
type Command interface { rangedb.AggregateMessage CommandType() string }
Command is the interface for CQRS commands.
type CommandDispatcher ¶
type CommandHandler ¶
type CommandHandler interface { PendingEvents Handle(command Command) }
type CommandHandlerFactory ¶
type CommandHandlerFactory func(command Command) CommandHandler
type IssueRefreshTokenToUser ¶
type OnBoardUser ¶
type Option ¶
type Option func(*App)
Option defines functional option parameters for App.
func WithLogger ¶
WithLogger is a functional option to inject a Logger.
func WithTokenGenerator ¶
func WithTokenGenerator(generator TokenGenerator) Option
WithTokenGenerator is a functional option to inject a token generator.
type PendingEvents ¶
PendingEvents is the interface for retrieving CQRS events that will be saved to the event store.
type PreCommandHandler ¶
type PreCommandHandler interface { PendingEvents CommandTypes() []string Handle(command Command) (shouldContinue bool) }
type RequestAccessTokenViaAuthorizationCodeGrantWasRejectedDueToInvalidClientApplicationRedirectURI ¶
type RequestAccessTokenViaClientCredentialsGrantWasRejectedDueToInvalidClientApplicationID ¶
type RequestAccessTokenViaClientCredentialsGrantWasRejectedDueToInvalidClientApplicationID struct {
ClientID string `json:"clientID"`
}
type RequestAccessTokenViaClientCredentialsGrantWasRejectedDueToInvalidClientApplicationSecret ¶
type RequestAccessTokenViaClientCredentialsGrantWasRejectedDueToInvalidClientApplicationSecret struct {
ClientID string `json:"clientID"`
}
type RequestAccessTokenViaRefreshTokenGrantWasRejectedDueToPreviouslyUsedRefreshToken ¶
type RequestAccessTokenViaRefreshTokenGrantWasRejectedDueToPreviouslyUsedRefreshToken struct {
RefreshToken string `json:"refreshToken"`
}
type RequestAuthorizationCodeViaAuthorizationCodeGrantWasRejectedDueToInvalidClientApplicationRedirectURI ¶
type TokenGenerator ¶
type TokenGenerator interface {
New() string
}
TokenGenerator defines a token generator for refresh tokens and authorization codes.
Source Files ¶
- authorization_code.go
- authorization_code_commands.go
- authorization_code_events.go
- authorization_code_process_manager.go
- authorization_code_refresh_tokens_projection.go
- client_application.go
- client_application_command_authorization.go
- client_application_commands.go
- client_application_events.go
- commands.go
- events.go
- goauth2.go
- passwords.go
- refresh_token.go
- refresh_token_commands.go
- refresh_token_events.go
- refresh_token_process_manager.go
- resource_owner.go
- resource_owner_command_authorization.go
- resource_owner_commands.go
- resource_owner_events.go