authentication

package
v0.0.0-...-2921379 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMicrosoftOpenIDJWKS

func GetMicrosoftOpenIDJWKS() jose.JSONWebKeySet

GetMicrosoftOpenIDJWKS returns the JWKS for Microsoft authentication

Types

type AuthClaims

type AuthClaims struct {
	BasicClaims
	MicrosoftSpecificAuthClaims
	Subject            string `json:"sub,omitempty"`
	FullName           string `json:"name,omitempty"`
	Authenticated      bool   `json:"authed,omitempty"`    // This value is set true once any extra authentication has been completed (such as MFA or forced password change). If false DO NOT USE!
	AuthenticationOnly bool   `json:"auth_only,omitempty"` // Set true for Windows MDM enrollment. If true DO NOT USE!
}

AuthClaims contains the JWT claims for the authentication token issued by Mattrax's internal authentication

type BasicClaims

type BasicClaims struct {
	Issuer   string           `json:"iss"`
	Audience string           `json:"aud"`
	IssuedAt *jwt.NumericDate `json:"iat"`
	Expiry   *jwt.NumericDate `json:"exp"`
}

BasicClaims contains the generic JWT claims. These are shared between internal and externally issued tokens.

type MicrosoftSpecificAuthClaims

type MicrosoftSpecificAuthClaims struct {
	ObjectID          string `json:"oid,omitempty"`
	UserPrincipalName string `json:"upn,omitempty"`
	TenantID          string `json:"tid,omitempty"`
	Name              string `json:"name,omitempty"`
	DeviceID          string `json:"deviceid,omitempty"`
}

MicrosoftSpecificAuthClaims has the claims for Microsoft AzureAD authentication tokens.

type OpenIDConfiguration

type OpenIDConfiguration struct {
	JWKSURI string `json:"jwks_uri"`
}

OpenIDConfiguration contains the configuration for a servers OpenID endpoints

type Service

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

Service provides helpers for verifying and creating authentication tokens

func New

func New(certService *certificates.Service, cache *cache.Cache, db *db.Queries, domain string, debugMode bool) (*Service, error)

New returns a new AuthenticationService after it has been initialised

func (Service) IssueToken

func (as Service) IssueToken(audience string, claims AuthClaims) (string, BasicClaims, error)

IssueToken creates a new token from claims

func (Service) Token

func (as Service) Token(rawToken string) (AuthClaims, error)

Token parses a JWT, verifies it is valid and returns the claims held inside it

Jump to

Keyboard shortcuts

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