authentication

package
v0.0.0-...-bd74845 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EUAPrincipal

type EUAPrincipal struct {
	EUAID           string
	JobCodeEASi     bool
	JobCodeGRT      bool
	JobCodeTRBAdmin bool
	UserAccount     *UserAccount
}

EUAPrincipal represents information gleaned from the Okta JWT

func (*EUAPrincipal) Account

func (p *EUAPrincipal) Account() *UserAccount

Account returns the UserAccount of an EUAPrincipal

func (*EUAPrincipal) AllowEASi

func (p *EUAPrincipal) AllowEASi() bool

AllowEASi says whether this principal is authorized to operate within EASi

func (*EUAPrincipal) AllowGRT

func (p *EUAPrincipal) AllowGRT() bool

AllowGRT says whether this principal is authorized to operate as part of the Review Team within EASi

func (*EUAPrincipal) AllowTRBAdmin

func (p *EUAPrincipal) AllowTRBAdmin() bool

AllowTRBAdmin says whether this principal is authorized to operate as an admin of the TRB process within EASi

func (*EUAPrincipal) ID

func (p *EUAPrincipal) ID() string

ID returns the EUA ID for the given Principal

func (*EUAPrincipal) String

func (p *EUAPrincipal) String() string

String satisfies the fmt.Stringer interface

type EnhancedJwt

type EnhancedJwt struct {
	JWT       *jwtverifier.Jwt
	AuthToken string
}

EnhancedJwt is the JWT and the auth token

func (*EnhancedJwt) GetOktaBaseURL

func (ejwt *EnhancedJwt) GetOktaBaseURL() (*string, error)

GetOktaBaseURL returns the OktaBaseURL for the user in the context of the request and errors if the context doesn't have one

type GetUserAccountFromDBFunc

type GetUserAccountFromDBFunc func(ctx context.Context, id uuid.UUID) (*UserAccount, error)

GetUserAccountFromDBFunc defines a function that returns a user account from the database

type Principal

type Principal interface {
	fmt.Stringer

	// ID returns the system identifier
	// for the given Principal
	ID() string

	// AllowEASi says whether this principal
	// is authorized to operate within EASi
	AllowEASi() bool

	// AllowGRT says whether this principal
	// is authorized to operate as part of
	// the Review Team within EASi
	AllowGRT() bool

	// AllowTRBAdmin says whether this principal
	// is authorized to operate as an admin of the TRB process within EASi
	AllowTRBAdmin() bool

	Account() *UserAccount
}

Principal defines the expected behavior for an entity that is making requests of the system.

var ANON Principal = (*anonymous)(nil)

ANON is functionally a singleton for representing a request without an identity

type UserAccount

type UserAccount struct {
	ID          uuid.UUID `json:"id" db:"id"`
	Username    string    `json:"username" db:"username"`
	CommonName  string    `json:"commonName" db:"common_name"`
	Locale      string    `json:"locale" db:"locale"`
	Email       string    `json:"email" db:"email"`
	GivenName   string    `json:"given_name" db:"given_name"`
	FamilyName  string    `json:"family_name" db:"family_name"`
	ZoneInfo    string    `json:"zoneinfo" db:"zone_info"`
	HasLoggedIn bool      `json:"hasLoggedIn" db:"has_logged_in"`
}

UserAccount represents a user from the database

Jump to

Keyboard shortcuts

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