Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudienceCustomClaims ¶
type AudienceCustomClaims struct {
Scope string `json:"scope"` // This is a mandatory claim that MUST be present in the token
// contains filtered or unexported fields
}
type Config ¶
type Config struct {
AuthServerURL string // URL of the Auth server (e.g. http://oauthserver:8080/realms/sfn.nef for KeyCloak)
IssuerURL string // In case when Auth Server exposes an external or different IssuerURL. If empty AuthServerURL will be used
PubKeyCacheDuration time.Duration // Duration to store the RSA Pubic Key
Audience []string // The intended Audience the AccessToken should have (as configured in AuthServer)
AuthorizedScope []string // Allowed scopes to be validated against. At this point they MUST have http.Methods to be validated with route
}
Config related to JWT based OAuth2 Authorization
type OAuth2Provider ¶
type OAuth2Provider struct {
Conf Config
}
func New ¶
func New(conf *Config) (*OAuth2Provider, error)
func (*OAuth2Provider) AuthorizationMiddleware ¶
func (o *OAuth2Provider) AuthorizationMiddleware() (gin.HandlerFunc, error)
This can be used as a Middleware or a GinHandlerFunc for a specific route
Click to show internal directories.
Click to hide internal directories.