Documentation ¶
Index ¶
- Constants
- Variables
- func AddNewUser(user User)
- func AddValueToList(values []byte, newKey string, newValue string) []byte
- func ExtractClaims(tokenString string) jwt.MapClaims
- func GetAdminAccessToken() string
- func GetUser(userId string) []byte
- func SetUserPassword(path string, password string, admin_token string)
- func SignInRequest(credentials Credentials) []byte
- func SignUpRequest(user User, admin_token string) string
- type Credentials
- type KeycloakUser
- type TokenResponse
- type User
Constants ¶
View Source
const KeycloakPath = "http://keycloak"
View Source
const MicroserviceUserPath = "http://microservice-user:9090"
Variables ¶
View Source
var ErrorEnvVar = fmt.Errorf("missing environment variable")
ErrorEnvVar : Environment variable error
Functions ¶
func AddNewUser ¶
func AddNewUser(user User)
func ExtractClaims ¶
func ExtractClaims(tokenString string) jwt.MapClaims
Extract a specific claim for the jwt token
func GetAdminAccessToken ¶
func GetAdminAccessToken() string
func SetUserPassword ¶
func SignInRequest ¶
func SignInRequest(credentials Credentials) []byte
func SignUpRequest ¶
Types ¶
type Credentials ¶
type KeycloakUser ¶
type KeycloakUser struct { Username string `json:"username"` Email string `json:"email"` FirstName string `json:"firstName"` LastName string `json:"lastName"` Enabled bool `json:"enabled"` }
func UserToKeycloakUser ¶
func UserToKeycloakUser(user User) KeycloakUser
type TokenResponse ¶
type TokenResponse struct { AccessToken string `json:"access_token"` ExpiresIn int `json:"expires_in"` RefreshExpiresIn int `json:"refresh_expires_in"` RefreshToken string `json:"refresh_token"` TokenType string `json:"token_type"` NotBeforePolicy int `json:"not-before-policy"` SessionState string `json:"session_state"` Scope string `json:"scope"` }
func GetAccessToken ¶
func GetAccessToken(credentials Credentials) TokenResponse
type User ¶
type User struct { ID string `json:"id" bson:"_id"` Username string `json:"username"` Password string `json:"password"` Email string `json:"email"` FirstName string `json:"firstname"` LastName string `json:"lastname"` DateOfBirth string `json:"dateofbirth"` Gender string `json:"gender"` Address string `json:"address"` Bio string `json:"bio"` Achievements string `json:"achievements"` }
Click to show internal directories.
Click to hide internal directories.