authn

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: Apache-2.0 Imports: 20 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 AuthenticationService) api.Router

NewAuthnAPIController creates a default api controller

func WithLoginSessionFromRequest

func WithLoginSessionFromRequest(l log.Logger, w http.ResponseWriter, r *http.Request, scopes []string, 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 AuthenticationService added in v0.2.4

type AuthenticationService interface {
	LoginWithCredentials(req *http.Request, credentials client.Login, nonce string, ip string, photoURL *string) (*http.Cookie, *client.LoggedIn, error)
	RegisterWithCredentials(*http.Request, client.Register, string, string, bool) (*http.Cookie, *client.LoggedIn, error)
}

AuthenticationApiServicer defines the api actions for the AuthenticationApi service

func NewAuthnService

func NewAuthnService(
	log logging.Logger,
	credentials credentials.CredentialsService,
	identities identities.Service,
	token session.TokenService,
	invites invites.InvitesService,
) AuthenticationService

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

type Config

type Config struct {
	Keys webkeys.WebKeysConfig
}

type LoginSession

type LoginSession struct {
	jwe.Claims

	// CSRF state token used during login
	State string `json:"st"`

	// Domain this was created under and only usable under.
	Origin string `json:"or"`

	// Flow this session was stated with and must end with
	Flow string `json:"fl"`

	// List of available providers for the tenantID
	Providers []string `json:"ps,omitempty"`

	// Provider that supplied the SubjectID
	Provider string `json:"pv,omitempty"`

	// Unique ID of the user under the external provider.
	SubjectID string `json:"si,omitempty"`

	// Set during logging in everytime and used to look up credentials
	Issuer *string `json:"pi"` // 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"`

	// Login URL for the start of the flow
	LoginURL string `json:"lu"`

	// Store whatever we can get from the OIDC provider if the invite code isn't empty
	identity.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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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