Documentation ¶
Index ¶
- func AllowEmptyCookie() func(*MiddlewareConfig)
- func FromConfig(cfg config.Oidc) func(*MiddlewareConfig)
- func NewOauthMiddleware(svc UserService, options ...func(*MiddlewareConfig)) fiber.Handler
- type JSONWebToken
- type MiddlewareConfig
- type Provider
- type RedirectURL
- type Service
- type State
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowEmptyCookie ¶
func AllowEmptyCookie() func(*MiddlewareConfig)
func FromConfig ¶
func FromConfig(cfg config.Oidc) func(*MiddlewareConfig)
func NewOauthMiddleware ¶
func NewOauthMiddleware(svc UserService, options ...func(*MiddlewareConfig)) fiber.Handler
Types ¶
type JSONWebToken ¶
type JSONWebToken struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` IDToken string `json:"id_token"` Scope string `json:"scope"` ExpiresIn int `json:"expires_in"` Type string `json:"token_type"` Provider string `json:"provider"` }
func DecodeToken ¶
func DecodeToken(value string) (*JSONWebToken, error)
DecodeToken decode given base64 url encoded JSONWebToken.
func (*JSONWebToken) Encode ¶
func (t *JSONWebToken) Encode() (string, error)
type MiddlewareConfig ¶
type Provider ¶
type Provider interface { GetName() string GetAuthURL(state string, redirectURL string) string ExchangeCode(ctx context.Context, authCode string, redirectURI string) (*claims, *JSONWebToken, error) ValidateToken(ctx context.Context, token *JSONWebToken) (*claims, error) RevokeToken(ctx context.Context, token string) error }
func FromConfiguration ¶
type RedirectURL ¶
func NewRedirectURL ¶
func NewRedirectURL(p Provider, redirectURI string) (*RedirectURL, error)
type Service ¶
type Service interface { UserService GetAuthURL(provider string) (*RedirectURL, error) Authenticate(provider string, code string) (*auth.User, *JSONWebToken, error) Logout(token *JSONWebToken) error }
type State ¶
func DecodeState ¶
DecodeState decode given base64 url encoded State.
type UserService ¶
type UserService interface {
GetAuthenticatedUser(provider string, token *JSONWebToken) (*auth.User, error)
}
Click to show internal directories.
Click to hide internal directories.