auth

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResetPasswordEmail

func GetResetPasswordEmail(set *settings.Settings, u *user.User, code string) (*email.Message, error)

Types

type AccessClaims

type AccessClaims struct {
	Groups   []uuid.UUID            `json:"gps,omitempty"`
	MetaData map[string]interface{} `json:"meta_data,omitempty"`

	RigClaims
}

The metadata stored in all access tokens.

type ProjectClaims

type ProjectClaims struct {
	UseProjectID uuid.UUID `json:"aid"`

	RigClaims
}

type RefreshClaims

type RefreshClaims struct {
	Groups []uuid.UUID `json:"gps,omitempty"`

	RigClaims
}

The metadata stored in all refresh tokens.

type RigClaims

type RigClaims struct {
	ProjectID   uuid.UUID        `json:"pid"`
	Subject     uuid.UUID        `json:"sub"`
	SubjectType auth.SubjectType `json:"sty"`
	SessionID   uuid.UUID        `json:"jti,omitempty"`

	jwt.StandardClaims
}

func (RigClaims) GetIssuer

func (c RigClaims) GetIssuer() string

func (RigClaims) GetProjectID

func (c RigClaims) GetProjectID() uuid.UUID

func (RigClaims) GetSessionID

func (c RigClaims) GetSessionID() uuid.UUID

func (RigClaims) GetSubject

func (c RigClaims) GetSubject() uuid.UUID

func (RigClaims) GetSubjectType

func (c RigClaims) GetSubjectType() auth.SubjectType

type Service

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

func NewService

func NewService(p newServiceParams) (*Service, error)

func (*Service) CreateServiceAccount

func (s *Service) CreateServiceAccount(ctx context.Context, name string, managed bool) (*service_account.ServiceAccount, string, string, error)

func (*Service) DeleteServiceAccount

func (s *Service) DeleteServiceAccount(ctx context.Context, serviceAccountID uuid.UUID) error

func (*Service) GetAuthor

func (s *Service) GetAuthor(ctx context.Context) (*model.Author, error)

func (*Service) GetJWTMethod

func (s *Service) GetJWTMethod() (jwt.SigningMethod, string)

func (*Service) GetOauth2Providers

func (s *Service) GetOauth2Providers(ctx context.Context, redirect string) ([]*authentication.OauthProvider, error)

func (*Service) ListServiceAccounts

func (s *Service) ListServiceAccounts(ctx context.Context) (iterator.Iterator[*service_account.Entry], error)

func (*Service) ListSessions

func (s *Service) ListSessions(ctx context.Context, userID uuid.UUID) (iterator.Iterator[*user.SessionEntry], error)

func (*Service) LoginClientCredentials

func (s *Service) LoginClientCredentials(ctx context.Context, clientID, clientSecret string) (*authentication.Token, error)

func (*Service) LoginOauth2

func (s *Service) LoginOauth2(ctx context.Context, claims *auth.Oauth2Claims, provider *settings.OauthProviderSettings) (*authentication.Token, error)

func (*Service) LoginUserPassword

func (s *Service) LoginUserPassword(ctx context.Context, id *model.UserIdentifier, pw string) (uuid.UUID, *model.UserInfo, *authentication.Token, error)

func (*Service) Logout

func (s *Service) Logout(ctx context.Context) error

func (*Service) RefreshToken

func (s *Service) RefreshToken(ctx context.Context, oldRefreshToken string) (*authentication.Token, error)

func (*Service) ResetPassword

func (s *Service) ResetPassword(ctx context.Context, identifier *model.UserIdentifier, code, newPassword string) error

func (*Service) SendPasswordReset

func (s *Service) SendPasswordReset(ctx context.Context, identifier *model.UserIdentifier) error

func (*Service) UseProject

func (s *Service) UseProject(ctx context.Context, projectID uuid.UUID) (string, error)

func (*Service) ValidateAccessToken

func (s *Service) ValidateAccessToken(ctx context.Context, jwtToken string) (*AccessClaims, error)

func (*Service) ValidateProjectToken

func (s *Service) ValidateProjectToken(ctx context.Context, jwtToken string) (*ProjectClaims, error)

func (*Service) VerifyEmail

func (s *Service) VerifyEmail(ctx context.Context, email string, code string) error

func (*Service) VerifyPhoneNumber

func (s *Service) VerifyPhoneNumber(ctx context.Context, email string, code string) error

Jump to

Keyboard shortcuts

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