identity

package
v0.0.181 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package for working with corpora with private login required.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAuthorized

func IsAuthorized(user UserInfo, permission string) bool

Generate a new session id after login

func NewSessionId

func NewSessionId() string

Generate a new session id after login

func SendPasswordReset added in v0.0.30

func SendPasswordReset(toUser UserInfo, token string, c config.WebAppConfig) error

Types

type Authenticator added in v0.0.15

type Authenticator interface {
	ChangePassword(ctx context.Context, userInfo UserInfo, oldPassword, password string) ChangePasswordResult
	CheckLogin(ctx context.Context, username, password string) ([]UserInfo, error)
	CheckSession(ctx context.Context, sessionid string) SessionInfo
	GetUser(ctx context.Context, username string) ([]UserInfo, error)
	Logout(ctx context.Context, sessionid string)
	RequestPasswordReset(ctx context.Context, email string) RequestResetResult
	ResetPassword(ctx context.Context, token, password string) bool
	SaveSession(ctx context.Context, sessionid string, userInfo UserInfo, authenticated int) SessionInfo
	UpdateSession(ctx context.Context, sessionid string, userInfo UserInfo, authenticated int) SessionInfo
}

func NewAuthenticator added in v0.0.17

func NewAuthenticator(client fsClient, corpus string) Authenticator

Create a new Authenticator with a Firestore client

type ChangePasswordResult

type ChangePasswordResult struct {
	OldPasswordValid bool
	ChangeSuccessful bool
	ShowNewForm      bool
}

func OldPasswordDoesNotMatch

func OldPasswordDoesNotMatch() ChangePasswordResult

Old password does not match

type RequestResetRecord added in v0.0.154

type RequestResetRecord struct {
	EmailValid          bool   `firestore:"email_valid"`
	RequestResetSuccess bool   `firestore:"request_reset_success"`
	Email               string `firestore:"email"`
	UserName            string `firestore:"username"`
	Token               string `firestore:"token"`
}

type RequestResetResult

type RequestResetResult struct {
	EmailValid          bool
	RequestResetSuccess bool
	ShowNewForm         bool
	User                UserInfo
	Token               string
}

type SessionInfo

type SessionInfo struct {
	Authenticated int
	Valid         bool
	User          UserInfo
}

func InvalidSession

func InvalidSession() SessionInfo

InvalidSession creates an empty session struct.

type SessionRecord added in v0.0.154

type SessionRecord struct {
	Authenticated int    `firestore:"authenticated"`
	Valid         bool   `firestore:"valid"`
	UserName      string `firestore:"username"`
}

type UserInfo

type UserInfo struct {
	UserID   int    `firestore:"userid"`
	UserName string `firestore:"username"`
	Email    string `firestore:"email"`
	FullName string `firestore:"fullname"`
	Role     string `firestore:"role"`
	Password string `firestore:"password"`
}

func InvalidUser

func InvalidUser() UserInfo

Empty session struct for an unauthenticated session

Jump to

Keyboard shortcuts

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