Documentation
¶
Index ¶
- type IntrospectionResponse
- type IntrospectionTokenStore
- func (s *IntrospectionTokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error
- func (s *IntrospectionTokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)
- func (s *IntrospectionTokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)
- func (s *IntrospectionTokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)
- func (s *IntrospectionTokenStore) RemoveByAccess(ctx context.Context, access string) error
- func (s *IntrospectionTokenStore) RemoveByCode(ctx context.Context, code string) error
- func (s *IntrospectionTokenStore) RemoveByRefresh(ctx context.Context, refresh string) error
- type RouteHandler
- type Router
- func (r *Router) AllowCORS()
- func (r *Router) EnableAuth(introspectURL string, clientId string, clientSecret string) error
- func (r *Router) EnableSentry(dsn string)
- func (r *Router) GetEngine() *gin.Engine
- func (r *Router) RegisterRoute(cnt controller.Controller)
- func (r *Router) RegisterRoutes(controllers []controller.Controller)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IntrospectionResponse ¶
type IntrospectionResponse struct {
Active bool `json:"active"`
ClientID string `json:"client_id"`
Username string `json:"username,omitempty"`
Scope string `json:"scope,omitempty"`
Exp int64 `json:"exp,omitempty"`
TokenType string `json:"token_type,omitempty"`
}
IntrospectionResponse models what most OAuth2 servers return at /introspect
type IntrospectionTokenStore ¶
type IntrospectionTokenStore struct {
IntrospectURL string
ClientID string
ClientSecret string
HTTPClient *http.Client
}
IntrospectionTokenStore implements oauth2.TokenStore by calling /introspect
func NewIntrospectionTokenStore ¶
func NewIntrospectionTokenStore(url, clientID, clientSecret string) *IntrospectionTokenStore
func (*IntrospectionTokenStore) GetByAccess ¶
func (s *IntrospectionTokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)
GetByAccess calls the introspection endpoint and, if active, returns a TokenInfo
func (*IntrospectionTokenStore) GetByRefresh ¶
func (*IntrospectionTokenStore) RemoveByAccess ¶
func (s *IntrospectionTokenStore) RemoveByAccess(ctx context.Context, access string) error
We don’t need refresh tokens here.
func (*IntrospectionTokenStore) RemoveByCode ¶
func (s *IntrospectionTokenStore) RemoveByCode(ctx context.Context, code string) error
func (*IntrospectionTokenStore) RemoveByRefresh ¶
func (s *IntrospectionTokenStore) RemoveByRefresh(ctx context.Context, refresh string) error
type RouteHandler ¶
type RouteHandler interface {
RegisterRoutes(controllers []controller.Controller)
RegisterRoute(controller controller.Controller)
GetEngine() *gin.Engine
EnableAuth(introspectURL string, clientId string, clientSecret string) error
AllowCORS()
EnableSentry(dsn string)
}
func NewRouteHandler ¶
func NewRouteHandler(baseUrl string) (RouteHandler, error)
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) EnableAuth ¶
func (*Router) EnableSentry ¶
func (*Router) RegisterRoute ¶
func (r *Router) RegisterRoute(cnt controller.Controller)
func (*Router) RegisterRoutes ¶
func (r *Router) RegisterRoutes(controllers []controller.Controller)
Click to show internal directories.
Click to hide internal directories.