Documentation ¶
Index ¶
- Variables
- func CreateJWTToken(uuid string, jwtConfig *JwtToken) (string, error)
- func CreateShigInstanceId(_ string) uuid.UUID
- func Csrf(f http.HandlerFunc) http.HandlerFunc
- func DeleteSession(w http.ResponseWriter, r *http.Request) error
- func HttpMiddleware(ac *SecurityConfig, f http.HandlerFunc) http.HandlerFunc
- func SetNewRequestToken(w http.ResponseWriter, user string)
- func StartSession(w http.ResponseWriter, r *http.Request) error
- func TokenMiddleware(f http.HandlerFunc) http.HandlerFunc
- func ValidateSecurityConfig(config *SecurityConfig) error
- type Account
- type AccountRepository
- type AccountService
- type Claims
- type JwtToken
- type Principal
- type SecurityConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoUserSession = errors.New("no user in session") ErrNotAuthenticatedSession = errors.New("not authenticated session") ErrNoCsrfTokenInSession = errors.New("no csrf token in session") )
View Source
var ErrAccountNotFound = errors.New("account not found")
Functions ¶
func CreateJWTToken ¶
CreateJWTToken generates a JWT signed token for for the given user
func CreateShigInstanceId ¶
func Csrf ¶
func Csrf(f http.HandlerFunc) http.HandlerFunc
func DeleteSession ¶
func DeleteSession(w http.ResponseWriter, r *http.Request) error
func HttpMiddleware ¶
func HttpMiddleware(ac *SecurityConfig, f http.HandlerFunc) http.HandlerFunc
func SetNewRequestToken ¶
func SetNewRequestToken(w http.ResponseWriter, user string)
func StartSession ¶
func StartSession(w http.ResponseWriter, r *http.Request) error
func TokenMiddleware ¶
func TokenMiddleware(f http.HandlerFunc) http.HandlerFunc
func ValidateSecurityConfig ¶
func ValidateSecurityConfig(config *SecurityConfig) error
Types ¶
type Account ¶
type AccountRepository ¶
type AccountRepository struct {
// contains filtered or unexported fields
}
func NewAccountRepository ¶
func NewAccountRepository(store storage.Storage) *AccountRepository
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
func NewAccountService ¶
func NewAccountService(repo *AccountRepository, instanceToken string, config *SecurityConfig) *AccountService
func (*AccountService) CreateAccountByActor ¶
func (s *AccountService) CreateAccountByActor(actor *models.Actor) error
func (*AccountService) DeleteAccountByActor ¶
func (s *AccountService) DeleteAccountByActor(actor *models.Actor) error
func (*AccountService) GetAuthToken ¶
func (s *AccountService) GetAuthToken(ctx context.Context, user *authentication.User) (*authentication.Token, error)
type Claims ¶
type Claims struct { UUID string `json:"uuid"` jwt.RegisteredClaims }
func (*Claims) GetUuidString ¶
type JwtToken ¶
type Principal ¶
type Principal struct {
UUID string `json:"uuid"`
}
func (*Principal) GetUuidString ¶
type SecurityConfig ¶
Click to show internal directories.
Click to hide internal directories.