authn

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const LoginSessionContextKey contextKey = "login-session"

LoginSessionContextKey is the context key for the Login Session

Variables

This section is empty.

Functions

func DeleteAuthnCookie

func DeleteAuthnCookie(response http.ResponseWriter)

func GetAuthnCookie

func GetAuthnCookie(request *http.Request) (*http.Cookie, error)

func NewAuthnAPIController

func NewAuthnAPIController(logger log.Logger, s api.InternalApiServicer) api.Router

NewAuthnAPIController creates a default api controller

func NewAuthnService

func NewAuthnService(
	log logging.Logger,
	credentials credentials.CredentialsService,
	identities identities.Service,
	token session.SessionService,
	invites api.InvitesApiServicer,
	landingURL string,
) api.InternalApiServicer

NewAuthnService - Creates a default service that handles the registration and login

func WithLoginSessionFromRequest

func WithLoginSessionFromRequest(l log.Logger, w http.ResponseWriter, r *http.Request, run func(LoginSession))

WithLoginSessionFromRequest - Pulls the Login Session out of the context of a request if its not available returns an error response on `w`.

Types

type Config

type Config struct {
	LandingURL string
	Keys       webkeys.WebKeysConfig
}

type LoginSession

type LoginSession struct {
	State string `json:"state"` // CSRF state token used during login

	// Set during logging in everytime and used to look up credentials
	Issuer *string `json:"issuer"` // Issuer attribute of the login

	// IP Address of the login
	IP string `json:"ip"`

	// Scope of what this token is allow to do.
	Scopes []string `'json:"scp"`

	// standard JWT claims like expirations etc...
	jwe.Claims

	// Store whatever we can get from the OIDC provider if the invite code isn't empty
	api.Register
}

LoginSession is the values of the JWT coming in from the Authentication services.

func LoginSessionFromRequest

func LoginSessionFromRequest(r *http.Request) (*LoginSession, error)

LoginSessionFromRequest - Pulls the Login Session out of the context of a request

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

Middleware - Handles authenticating a request came from the authn services

func NewMiddleware

func NewMiddleware(log logging.Logger, time stime.TimeService, jweService jwe.JWEService) (*Middleware, error)

NewMiddleware - Generates a default AuthnMiddleware for use with authenticating a request came from the authn services

func (*Middleware) FromRequest

func (s *Middleware) FromRequest(r *http.Request) (*LoginSession, error)

FromRequest - Pulls out authenticationd details from the Request and calls Parse.

func (*Middleware) Handler

func (s *Middleware) Handler(h http.Handler) http.Handler

Handler - Generates the handler you use to wrap the http routes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL