Documentation ¶
Index ¶
- Constants
- Variables
- func AuthedRequest(t *testing.T, claims Claims) *http.Request
- func GatewayPassed(r *http.Request) bool
- func GenerateKeys(log *logan.Entry, directoryPath string) error
- type AuthenticationType
- type Bouncer
- type Bouncerer
- type Claims
- type Gateway
- type Gatewayer
- type Identity
- type Opts
- type Rule
- type RuleFunc
- type Session
- type SessionProvider
- type StandardClaims
Constants ¶
View Source
const ( CookieName = "auth_348c070" // random suffix is needed to eliminate probability of names collision AuthorizationHeader = "Authorization" )
Variables ¶
View Source
var ( //ErrForbidden - requestor does not have sufficient permission to perform request - // non of the rules have not returned non nil response ErrForbidden = &forbidden{"forbidden"} //ErrInvalidToken - token is malformed, expired or not present ErrInvalidToken = ¬allowed{"invalid token"} )
View Source
var ( NewWithClaims = jwt.NewWithClaims SigningMethodES256 = jwt.SigningMethodES256 )
Functions ¶
func GatewayPassed ¶
func GenerateKeys ¶
GenerateKeys - generates keys used to sign JWT
Types ¶
type AuthenticationType ¶
type AuthenticationType string
AuthenticationType - defines authentication type of
const ( //AuthenticationTypeJWT - session ID + jwt token AuthenticationTypeJWT AuthenticationType = "jwt" //AuthenticationTypeBearer - session ID AuthenticationTypeBearer AuthenticationType = "bearer" )
type Claims ¶
type Claims struct { IdentityID string `json:"identity_id"` jwt.StandardClaims `log:"-"` }
type Gatewayer ¶
type Gatewayer interface {
Gateway() Gateway
}
func NewGatewayer ¶
func NewGatewayer(getter kv.Getter, storage SessionProvider, log *logan.Entry) Gatewayer
type Identity ¶
Identity allows to check constraints not bound to particular identity type.
func (Identity) IsAuthorized ¶
type Opts ¶
type Opts struct { // SkipChecks make any request with valid or missing token pass SkipChecks bool }
type RuleFunc ¶
The RuleFunc type is an adapter to allow the use of ordinary functions as Rule
func (RuleFunc) IsAuthorized ¶
type Session ¶
type Session struct { ID uuid.UUID Identity uuid.UUID Removed bool ExpiresAt time.Time AuthType AuthenticationType }
Session - represents auth primitive that could be controlled by identity
type SessionProvider ¶
SessionProvider - allows to access stored sessions
type StandardClaims ¶
type StandardClaims = jwt.StandardClaims
Click to show internal directories.
Click to hide internal directories.