Documentation ¶
Index ¶
- Variables
- func GetJWTPayload(auth string, results ...interface{}) (err error)
- type JwtPayload
- type JwtResource
- type JwtToken
- func (this JwtToken) Delete(url string) (resp *http.Response, err error)
- func (this JwtToken) Get(url string) (resp *http.Response, err error)
- func (this JwtToken) GetJSON(url string, result interface{}) (err error)
- func (this JwtToken) GetPayload() (result JwtPayload, err error)
- func (this JwtToken) Head(url string) (statuscode int, err error)
- func (this JwtToken) Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)
- func (this JwtToken) PostJSON(url string, body interface{}, result interface{}) (err error)
- func (this JwtToken) Put(url string, contentType string, body io.Reader) (resp *http.Response, err error)
- func (this JwtToken) PutJSON(url string, body interface{}, result interface{}) (err error)
- type KeycloakClaims
- type OpenidToken
- func GetOpenidPasswordToken(authEndpoint string, authClientId string, authClientSecret string, ...) (token OpenidToken, err error)
- func GetOpenidToken(authEndpoint string, authClientId string, authClientSecret string, ...) (openid OpenidToken, err error)
- func RefreshOpenidToken(authEndpoint string, authClientId string, authClientSecret string, ...) (openid OpenidToken, err error)
- type RealmAccess
- type RoleMapping
- type Security
- func (this *Security) Access() (token JwtToken, err error)
- func (this *Security) ExchangeUserToken(userid string, remoteInfo model.RemoteInfo) (token JwtToken, err error)
- func (this *Security) GenerateUserToken(username string) (token JwtToken, err error)
- func (this *Security) GenerateUserTokenById(userid string) (token JwtToken, err error)
- func (this *Security) GetCachedUserToken(username string, remoteInfo model.RemoteInfo) (token JwtToken, err error)
- func (this *Security) GetUserId(username string) (userid string, err error)
- func (this *Security) GetUserRoles(userid string) (roles []string, err error)
- func (this *Security) GetUserToken(username string, password string, remoteInfo model.RemoteInfo) (token JwtToken, err error)
- func (this *Security) ResetAccess()
- type UserRepresentation
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorAccessDenied = errors.New("access denied")
View Source
var ErrorInternal = errors.New("internal error")
View Source
var ErrorNotFound = errors.New("not found")
View Source
var ErrorUnexpectedStatus = errors.New("unexpected status")
Functions ¶
func GetJWTPayload ¶
Types ¶
type JwtPayload ¶
type JwtPayload struct { UserId string `json:"sub"` ResourceAccess map[string]JwtResource `json:"resource_access"` RealmAccess JwtResource `json:"realm_access"` }
type JwtResource ¶
type JwtResource struct {
Roles []string `json:"roles"`
}
type JwtToken ¶
type JwtToken string
func (JwtToken) GetPayload ¶
func (this JwtToken) GetPayload() (result JwtPayload, err error)
type KeycloakClaims ¶
type KeycloakClaims struct { RealmAccess RealmAccess `json:"realm_access"` jwt.StandardClaims }
type OpenidToken ¶
type OpenidToken struct { AccessToken string `json:"access_token"` ExpiresIn float64 `json:"expires_in"` RefreshExpiresIn float64 `json:"refresh_expires_in"` RefreshToken string `json:"refresh_token"` TokenType string `json:"token_type"` RequestTime time.Time `json:"-"` }
func GetOpenidPasswordToken ¶
func GetOpenidPasswordToken(authEndpoint string, authClientId string, authClientSecret string, username, password string, remoteInfo model.RemoteInfo) (token OpenidToken, err error)
func GetOpenidToken ¶
func GetOpenidToken(authEndpoint string, authClientId string, authClientSecret string, remoteInfo model.RemoteInfo) (openid OpenidToken, err error)
func RefreshOpenidToken ¶
func RefreshOpenidToken(authEndpoint string, authClientId string, authClientSecret string, oldOpenid OpenidToken, remoteInfo model.RemoteInfo) (openid OpenidToken, err error)
func (*OpenidToken) JwtToken ¶
func (this *OpenidToken) JwtToken() JwtToken
type RealmAccess ¶
type RealmAccess struct {
Roles []string `json:"roles"`
}
type RoleMapping ¶
type RoleMapping struct {
Name string `json:"name"`
}
type Security ¶
type Security struct {
// contains filtered or unexported fields
}
func New ¶
func New(authEndpoint string, authClientId string, authClientSecret string, jwtIssuer string, jwtPrivateKey string, jwtExpiration int64, authExpirationTimeBuffer float64, tokenCacheExpiration int32, cacheUrls []string, cacheMaxIdleConns int, cacheTimeout time.Duration) (security *Security, err error)
func (*Security) ExchangeUserToken ¶
func (*Security) GenerateUserToken ¶
func (*Security) GenerateUserTokenById ¶
func (*Security) GetCachedUserToken ¶
func (*Security) GetUserRoles ¶
func (*Security) GetUserToken ¶
func (*Security) ResetAccess ¶
func (this *Security) ResetAccess()
type UserRepresentation ¶
Click to show internal directories.
Click to hide internal directories.