Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTokenStringFromRequest ¶
GetTokenStringFromRequest is to get the token string from the request
Types ¶
type JWTClaimsJSON ¶
type JWTClaimsJSON struct {
Iat int `json:"iat"`
UID string `json:"uid"`
Username string `json:"username"`
Expiry int `json:"exp"`
Groups []string `json:"groups"`
}
JWTClaimsJSON is used for decoding an incoming JSON JWT payload to the /authenticate API
func (*JWTClaimsJSON) Valid ¶
func (c *JWTClaimsJSON) Valid() error
Valid so that JWTClaimsJSON satisfies the jwt.Claims interface
type Request ¶
type Request struct {
APIVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
Spec *Spec `json:"spec,omitempty"`
}
Request maps the incoming auth request from api-server
type Spec ¶
type Spec struct {
Token string `json:"token,omitempty"`
}
Spec maps to the bearer token send by api-server
type Status ¶
type Status struct {
Authenticated *bool `json:"authenticated,omitempty"`
User *User `json:"user,omitempty"`
}
Status indicates if user is authenticated or not
type Token ¶
type Token struct {
JWT string `json:"token,omitempty"`
Expiry time.Time `json:"expiry,omitempty"`
}
Token return JWT with its expiry time
func GenerateToken ¶
func GenerateToken(user User, authConfig config.AuthConfig) (Token, error)
GenerateToken generates JWT
type User ¶
type User struct {
Username string `json:"username,omitempty"`
UID string `json:"uid,omitempty"`
Groups []string `json:"groups,omitempty"`
}
User holds user information from AD
func ValidateUser ¶
ValidateUser validates user by extracting creds from the request body, then
authenticating against an ID backend and filling out the User struct from there.
type UserCredentials ¶
type UserCredentials struct {
UserName string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
}
UserCredentials holds user creds
type UserInfo ¶
type UserInfo struct {
APIVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
Status *Status `json:"status,omitempty"`
}
UserInfo holds authenticatoin information
func ValidateToken ¶
ValidateToken validates JWT token provided by user and fills out the UserInfo structure from the data within