Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAuthenticationHandler(handler http.Handler, rejector Rejector) http.Handler
- func CheckAuthorizationHandler(handler http.Handler, rejector Rejector) http.Handler
- func GetAuthTeamName(r *http.Request) string
- func GetTeam(r *http.Request) (string, int, bool, bool)
- func IsAuthenticated(r *http.Request) bool
- func NewOAuthBeginHandler(logger lager.Logger, providerFactory ProviderFactory, ...) http.Handler
- func NewOAuthCallbackHandler(logger lager.Logger, providerFactory ProviderFactory, ...) http.Handler
- func NewOAuthHandler(logger lager.Logger, providerFactory ProviderFactory, ...) (http.Handler, error)
- func WrapHandler(handler http.Handler, validator Validator, userContextReader UserContextReader) http.Handler
- type AuthDB
- type AuthorizationResponse
- type BasicAuthRejector
- type BasicAuthValidator
- type CookieSetHandler
- type JWTReader
- type JWTValidator
- type NoopValidator
- type OAuthBeginHandler
- type OAuthCallbackHandler
- type OAuthState
- type ProviderFactory
- type RedirectRejector
- type Rejector
- type TokenGenerator
- type TokenType
- type TokenValue
- type UnauthorizedRejector
- type UserContextReader
- type Validator
- type ValidatorBasket
Constants ¶
View Source
const ( OAuthBegin = "OAuthBegin" OAuthCallback = "OAuthCallback" )
View Source
const CookieAge = 24 * time.Hour
View Source
const CookieName = "ATC-Authorization"
View Source
const OAuthStateCookie = "_concourse_oauth_state"
View Source
const TokenTypeBearer = "Bearer"
Variables ¶
View Source
var ErrUnparsableHeader = errors.New("cannot parse 'Authorization' header")
View Source
var OAuthRoutes = rata.Routes{ {Path: "/auth/:provider", Method: "GET", Name: OAuthBegin}, {Path: "/auth/:provider/callback", Method: "GET", Name: OAuthCallback}, }
View Source
var SigningMethod = jwt.SigningMethodRS256
Functions ¶
func GetAuthTeamName ¶
func IsAuthenticated ¶
func NewOAuthBeginHandler ¶
func NewOAuthBeginHandler( logger lager.Logger, providerFactory ProviderFactory, privateKey *rsa.PrivateKey, ) http.Handler
func NewOAuthCallbackHandler ¶
func NewOAuthCallbackHandler( logger lager.Logger, providerFactory ProviderFactory, privateKey *rsa.PrivateKey, teamDBFactory db.TeamDBFactory, ) http.Handler
func NewOAuthHandler ¶
func NewOAuthHandler( logger lager.Logger, providerFactory ProviderFactory, teamDBFactory db.TeamDBFactory, signingKey *rsa.PrivateKey, ) (http.Handler, error)
func WrapHandler ¶
Types ¶
type AuthorizationResponse ¶
type AuthorizationResponse string
const ( Authorized AuthorizationResponse = "authorized" Forbidden AuthorizationResponse = "forbidden" )
func IsAuthorized ¶
func IsAuthorized(r *http.Request) (bool, AuthorizationResponse)
type BasicAuthRejector ¶
type BasicAuthRejector struct{}
func (BasicAuthRejector) Forbidden ¶
func (BasicAuthRejector) Forbidden(w http.ResponseWriter, r *http.Request)
func (BasicAuthRejector) Unauthorized ¶
func (BasicAuthRejector) Unauthorized(w http.ResponseWriter, r *http.Request)
type BasicAuthValidator ¶
type BasicAuthValidator struct {
TeamDBFactory db.TeamDBFactory
}
func (BasicAuthValidator) IsAuthenticated ¶
func (validator BasicAuthValidator) IsAuthenticated(r *http.Request) bool
IsAuthenticated basic authentication for login
type CookieSetHandler ¶
func (CookieSetHandler) ServeHTTP ¶
func (handler CookieSetHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type JWTValidator ¶
func (JWTValidator) IsAuthenticated ¶
func (validator JWTValidator) IsAuthenticated(r *http.Request) bool
type NoopValidator ¶
type NoopValidator struct{}
func (NoopValidator) IsAuthenticated ¶
func (NoopValidator) IsAuthenticated(*http.Request) bool
type OAuthBeginHandler ¶
type OAuthBeginHandler struct {
// contains filtered or unexported fields
}
func (*OAuthBeginHandler) ServeHTTP ¶
func (handler *OAuthBeginHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type OAuthCallbackHandler ¶
type OAuthCallbackHandler struct {
// contains filtered or unexported fields
}
func (*OAuthCallbackHandler) ServeHTTP ¶
func (handler *OAuthCallbackHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type OAuthState ¶
type ProviderFactory ¶
type RedirectRejector ¶
type RedirectRejector struct {
Location string
}
func (RedirectRejector) Forbidden ¶
func (rejector RedirectRejector) Forbidden(w http.ResponseWriter, r *http.Request)
func (RedirectRejector) Unauthorized ¶
func (rejector RedirectRejector) Unauthorized(w http.ResponseWriter, r *http.Request)
type TokenGenerator ¶
type TokenGenerator interface {
GenerateToken(expiration time.Time, teamName string, teamID int, isAdmin bool) (TokenType, TokenValue, error)
}
func NewTokenGenerator ¶
func NewTokenGenerator(privateKey *rsa.PrivateKey) TokenGenerator
type TokenValue ¶
type TokenValue string
type UnauthorizedRejector ¶
type UnauthorizedRejector struct{}
func (UnauthorizedRejector) Forbidden ¶
func (UnauthorizedRejector) Forbidden(w http.ResponseWriter, r *http.Request)
func (UnauthorizedRejector) Unauthorized ¶
func (UnauthorizedRejector) Unauthorized(w http.ResponseWriter, r *http.Request)
type UserContextReader ¶
type ValidatorBasket ¶
type ValidatorBasket []Validator
func (ValidatorBasket) IsAuthenticated ¶
func (vb ValidatorBasket) IsAuthenticated(r *http.Request) bool
Source Files ¶
- auth_db.go
- basic_auth_rejector.go
- basic_auth_validator.go
- check_auth_handler.go
- check_authorization_handler.go
- cookie_set_handler.go
- extract_username_and_password.go
- get_jwt.go
- get_team.go
- is_authenticated.go
- is_authorized.go
- jwt_reader.go
- jwt_validator.go
- noop_validator.go
- oauth_begin_handler.go
- oauth_callback_handler.go
- oauth_handler.go
- oauth_routes.go
- redirect_rejector.go
- rejector.go
- token_generator.go
- unauthorized_rejector.go
- user_context_reader.go
- validator.go
- validator_basket.go
- wrap_handler.go
Directories ¶
Path | Synopsis |
---|---|
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
|
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter |
githubfakes
This file was generated by counterfeiter
|
This file was generated by counterfeiter |
providerfakes
This file was generated by counterfeiter This file was generated by counterfeiter
|
This file was generated by counterfeiter This file was generated by counterfeiter |
Click to show internal directories.
Click to hide internal directories.