Documentation ¶
Index ¶
- Constants
- Variables
- func FromContext(ctx context.Context) (t Token, u User, c Client, ok bool)
- type AuthZHandler
- type Client
- type ClientDB
- type ClientIder
- type CreateObj
- type Heimdall
- func (h *Heimdall) CreateHandlerFunc(handlerFunc http.HandlerFunc, az AuthZHandler, np NoPermitHandler) http.HandlerFunc
- func (h *Heimdall) ExpandRequest(r *http.Request) (Token, Client, User)
- func (h *Heimdall) Login(w http.ResponseWriter, r *http.Request)
- func (h *Heimdall) OAuth2Authorize(w http.ResponseWriter, r *http.Request)
- func (h *Heimdall) OAuth2Token(w http.ResponseWriter, r *http.Request)
- func (h *Heimdall) OAuth2TokenInfo(w http.ResponseWriter, r *http.Request)
- func (h *Heimdall) OAuth2TokenInvalidation(w http.ResponseWriter, r *http.Request)
- func (h *Heimdall) Protect(w http.ResponseWriter, r *http.Request, handler http.Handler, az AuthZHandler)
- func (h *Heimdall) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type HeimdallDB
- type NoPermitHandler
- type PreAuthZHandler
- type Token
- type TokenDB
- type User
- type UserDB
- type UserIder
Constants ¶
View Source
const ( AuthorizationResponseTypeToken = "token" AuthorizationResponseTypeCode = "code" TokenGrantTypeAuthCode = "authorization_code" TokenGrantTypeClientCredentials = "client_credentials" TokenGrantTypeRefreshToken = "refresh_token" TokenGrantTypePassword = "password" TokenTypeBasic = "Basic" TokenTypeSession = "Session" TokenTypeBearer = "Bearer" TokenTypeRefresh = "Refresh" TokenTypeCode = "AuthorizationCode" TokenTypeConcent = "UserConcent" TokenAccessTypeOffline = "offline" TokenAccessTypeOnline = "online" )
View Source
const ( Permit = iota Deny Indeterminate NotApplicable )
Variables ¶
Functions ¶
Types ¶
type AuthZHandler ¶
type ClientIder ¶
type ClientIder interface {
ClientId(id string)
}
type Heimdall ¶
type Heimdall struct { Handler http.Handler DB HeimdallDB PreAuthZFunction PreAuthZHandler AuthZFunction AuthZHandler NoPermitFunction NoPermitHandler Templates *template.Template RewriteMe bool SessionDuration time.Duration AccessTokenDuration time.Duration RefreshTokenDuration time.Duration AuthCodeDuration time.Duration UserConcentDuration time.Duration SecureCookie bool }
func NewHeimdall ¶
func NewHeimdall(handler http.Handler, preauthzfunc PreAuthZHandler, authzfunc AuthZHandler, nopermitfunc NoPermitHandler) *Heimdall
func (*Heimdall) CreateHandlerFunc ¶
func (h *Heimdall) CreateHandlerFunc(handlerFunc http.HandlerFunc, az AuthZHandler, np NoPermitHandler) http.HandlerFunc
This function will allow you to leverage Heimdall to create fine grained policies on each handlerfunction you might have.
func (*Heimdall) ExpandRequest ¶
func (*Heimdall) OAuth2Authorize ¶
func (h *Heimdall) OAuth2Authorize(w http.ResponseWriter, r *http.Request)
func (*Heimdall) OAuth2Token ¶
func (h *Heimdall) OAuth2Token(w http.ResponseWriter, r *http.Request)
func (*Heimdall) OAuth2TokenInfo ¶
func (h *Heimdall) OAuth2TokenInfo(w http.ResponseWriter, r *http.Request)
func (*Heimdall) OAuth2TokenInvalidation ¶
func (h *Heimdall) OAuth2TokenInvalidation(w http.ResponseWriter, r *http.Request)
func (*Heimdall) Protect ¶
func (h *Heimdall) Protect(w http.ResponseWriter, r *http.Request, handler http.Handler, az AuthZHandler)
func (*Heimdall) ServeHTTP ¶
func (h *Heimdall) ServeHTTP(w http.ResponseWriter, r *http.Request)
The purpose of heimdalls handler is to protect another handler. It will first determine authentication through basic authentication, cookies, and authorization tokens. The second step will then call an authorization function with the incoming request as well as the user or token information.
type NoPermitHandler ¶
type PreAuthZHandler ¶
type Token ¶
type Token interface { GetId() string SetId(id string) GetType() string SetType(t string) GetUserId() string SetUserId(userId string) GetClientId() string SetClientId(clientId string) GetExpires() time.Time SetExpires(expires time.Time) GetScope() []string SetScope(scope []string) GetAccessType() string SetAccessType(accessType string) GetRefreshToken() string SetRefreshToken(refreshToken string) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.