use plain pkg module
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
committed by
Florian Schade
parent
259cbc2e56
commit
b07b5a1149
@@ -0,0 +1,39 @@
|
||||
package keycloak
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Nerzal/gocloak/v13"
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
)
|
||||
|
||||
// UserAction defines a type for user actions
|
||||
type UserAction int8
|
||||
|
||||
// An incomplete list of UserActions
|
||||
const (
|
||||
// UserActionUpdatePassword sets it that the user needs to change their password.
|
||||
UserActionUpdatePassword UserAction = iota
|
||||
// UserActionVerifyEmail sets it that the user needs to verify their email address.
|
||||
UserActionVerifyEmail
|
||||
)
|
||||
|
||||
// A lookup table to translate user actions to their string equivalents
|
||||
var userActionsToString = map[UserAction]string{
|
||||
UserActionUpdatePassword: "UPDATE_PASSWORD",
|
||||
UserActionVerifyEmail: "VERIFY_EMAIL",
|
||||
}
|
||||
|
||||
// PIIReport is a structure of all the PersonalIdentifiableInformation contained in keycloak.
|
||||
type PIIReport struct {
|
||||
UserData *libregraph.User
|
||||
Sessions []*gocloak.UserSessionRepresentation
|
||||
}
|
||||
|
||||
// Client represents a keycloak client.
|
||||
type Client interface {
|
||||
CreateUser(ctx context.Context, realm string, user *libregraph.User, userActions []UserAction) (string, error)
|
||||
SendActionsMail(ctx context.Context, realm, userID string, userActions []UserAction) error
|
||||
GetUserByUsername(ctx context.Context, realm, username string) (*libregraph.User, error)
|
||||
GetPIIReport(ctx context.Context, realm, username string) (*PIIReport, error)
|
||||
}
|
||||
Reference in New Issue
Block a user