Documentation ¶
Overview ¶
Package authserver models an OAuth 2.0 Authorization Server
Index ¶
- type AuthorizationServerService
- type DiscoveryConfig
- type RemoteService
- func (s *RemoteService) AuthorizationEndpoint() string
- func (s *RemoteService) GetTokens(authnMethod string, clientID string, clientSecret string, ...) (*TokenResponse, error)
- func (s *RemoteService) JwksEndpoint() string
- func (s *RemoteService) KeySet() keyset.KeySet
- func (s *RemoteService) SetKeySet(jwks keyset.KeySet)
- func (s *RemoteService) TokenEndpoint() string
- func (s *RemoteService) UserInfoEndpoint() string
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizationServerService ¶
type AuthorizationServerService interface { JwksEndpoint() string TokenEndpoint() string AuthorizationEndpoint() string UserInfoEndpoint() string KeySet() keyset.KeySet SetKeySet(keyset.KeySet) GetTokens(authnMethod string, clientID string, clientSecret string, authorizationCode string, redirectURI string, refreshToken string) (*TokenResponse, error) }
AuthorizationServerService represents an authorization server instance
func New ¶
func New(discoveryEndpoint string) AuthorizationServerService
New creates a RemoteService returning a AuthorizationServerService interface
type DiscoveryConfig ¶
type DiscoveryConfig struct { DiscoveryURL string Issuer string `json:"issuer"` AuthURL string `json:"authorization_endpoint"` TokenURL string `json:"token_endpoint"` JwksURL string `json:"jwks_uri"` UserInfoURL string `json:"userinfo_endpoint"` }
DiscoveryConfig encapsulates the discovery endpoint configuration
func (*DiscoveryConfig) OK ¶
func (c *DiscoveryConfig) OK() error
OK validates the result from a discovery configuration
type RemoteService ¶
type RemoteService struct { DiscoveryConfig // contains filtered or unexported fields }
RemoteService represents a remote authentication server Configuration is loaded asynchronously from the discovery endpoint
func (*RemoteService) AuthorizationEndpoint ¶
func (s *RemoteService) AuthorizationEndpoint() string
AuthorizationEndpoint returns the /authorization endpoint of the OAuth server
func (*RemoteService) GetTokens ¶
func (s *RemoteService) GetTokens(authnMethod string, clientID string, clientSecret string, authorizationCode string, redirectURI string, refreshToken string) (*TokenResponse, error)
GetTokens performs a request to the token endpoint
func (*RemoteService) JwksEndpoint ¶
func (s *RemoteService) JwksEndpoint() string
JwksEndpoint returns the /publicKeys endpoint of the OAuth server
func (*RemoteService) KeySet ¶
func (s *RemoteService) KeySet() keyset.KeySet
KeySet returns the instance's keyset
func (*RemoteService) SetKeySet ¶
func (s *RemoteService) SetKeySet(jwks keyset.KeySet)
SetKeySet stores a JWKs in the OAuth server
func (*RemoteService) TokenEndpoint ¶
func (s *RemoteService) TokenEndpoint() string
TokenEndpoint returns the /token endpoint of the OAuth server
func (*RemoteService) UserInfoEndpoint ¶
func (s *RemoteService) UserInfoEndpoint() string
UserInfoEndpoint returns the /userinfo endpoint of the OAuth server
type TokenResponse ¶
type TokenResponse struct { // The OAuth 2.0 Access Value AccessToken string `json:"access_token"` // The OIDC ID Value IdentityToken string `json:"id_token"` // The OAuth 2.0 Refresh Value RefreshToken string `json:"refresh_token"` // The token expiration time ExpiresIn int `json:"expires_in"` }
TokenResponse models an OAuth 2.0 /Value endpoint response