Documentation ¶
Index ¶
- Constants
- func APIKeyTokenRequest(apikey string, opts ...authentication.TokenOption) *authentication.TokenRequest
- func AuthorizationTokenRequest(code string, redirectURI string, opts ...authentication.TokenOption) *authentication.TokenRequest
- func CRTokenRequest(crToken string, profileID string, profileName string, ...) *authentication.TokenRequest
- func CRTokenRequestWithCRN(crToken string, profileID string, profileName string, profileCRN string, ...) *authentication.TokenRequest
- func OnetimePasscodeTokenRequest(passcode string, opts ...authentication.TokenOption) *authentication.TokenRequest
- func PasswordTokenRequest(username, password string, opts ...authentication.TokenOption) *authentication.TokenRequest
- func RefreshTokenRequest(refreshToken string, opts ...authentication.TokenOption) *authentication.TokenRequest
- func SetAccount(accountID string) authentication.TokenOption
- func SetIMSAccount(imsAccountID string) authentication.TokenOption
- func SetPhoneAuthToken(token string) authentication.TokenOption
- func SetSecurityCode(code string, vendor MFAVendor) authentication.TokenOption
- func SetSecurityQuestion(questionID int, answer string) authentication.TokenOption
- func SetTOTPCode(code string) authentication.TokenOption
- func SetVeriSignCode(code string) authentication.TokenOption
- type APIError
- type Config
- type Endpoint
- type Interface
- type MFAVendor
- type Requirement
- type Token
Constants ¶
const ( GrantTypePassword authentication.GrantType = "password" // #nosec G101 GrantTypeAPIKey authentication.GrantType = "urn:ibm:params:oauth:grant-type:apikey" // #nosec G101 GrantTypeOnetimePasscode authentication.GrantType = "urn:ibm:params:oauth:grant-type:passcode" // #nosec G101 GrantTypeAuthorizationCode authentication.GrantType = "authorization_code" GrantTypeRefreshToken authentication.GrantType = "refresh_token" GrantTypeDelegatedRefreshToken authentication.GrantType = "urn:ibm:params:oauth:grant-type:delegated-refresh-token" // #nosec G101 GrantTypeIdentityCookie authentication.GrantType = "urn:ibm:params:oauth:grant-type:identity-cookie" GrantTypeDerive authentication.GrantType = "urn:ibm:params:oauth:grant-type:derive" GrantTypeCRToken authentication.GrantType = "urn:ibm:params:oauth:grant-type:cr-token" // #nosec G101 )
Grant types
const ( ResponseTypeIAM authentication.ResponseType = "cloud_iam" ResponseTypeUAA authentication.ResponseType = "uaa" ResponseTypeIMS authentication.ResponseType = "ims_portal" ResponseTypeDelegatedRefreshToken authentication.ResponseType = "delegated_refresh_token" // #nosec G101 )
Response types
const ( InvalidTokenErrorCode = "BXNIM0407E" // #nosec G101 RefreshTokenExpiryErrorCode = "BXNIM0408E" // #nosec G101 ExternalAuthenticationErrorCode = "BXNIM0400E" SessionInactiveErrorCode = "BXNIM0439E" )
Variables ¶
This section is empty.
Functions ¶
func APIKeyTokenRequest ¶
func APIKeyTokenRequest(apikey string, opts ...authentication.TokenOption) *authentication.TokenRequest
func AuthorizationTokenRequest ¶
func AuthorizationTokenRequest(code string, redirectURI string, opts ...authentication.TokenOption) *authentication.TokenRequest
func CRTokenRequest ¶ added in v0.6.8
func CRTokenRequest(crToken string, profileID string, profileName string, opts ...authentication.TokenOption) *authentication.TokenRequest
CRTokenRequest builds a 'TokenRequest' struct from the user input. The value of 'crToken' is set as the value of the 'cr_token' form parameter of the request. 'profileID' and 'profileName' are optional parameters used to set the 'profile_id' and 'profile_name' form parameters in the request, respectively.
func CRTokenRequestWithCRN ¶ added in v0.8.0
func CRTokenRequestWithCRN(crToken string, profileID string, profileName string, profileCRN string, opts ...authentication.TokenOption) *authentication.TokenRequest
CRTokenRequestWithCRN builds a 'TokenRequest' struct from the user input. The value of 'crToken' is set as the value of the 'cr_token' form parameter of the request. 'profileID', 'profileName', and 'profileCRN' are optional parameters used to set the 'profile_id', 'profile_name', and 'profile_crn' form parameters in the request, respectively.
func OnetimePasscodeTokenRequest ¶
func OnetimePasscodeTokenRequest(passcode string, opts ...authentication.TokenOption) *authentication.TokenRequest
func PasswordTokenRequest ¶
func PasswordTokenRequest(username, password string, opts ...authentication.TokenOption) *authentication.TokenRequest
func RefreshTokenRequest ¶
func RefreshTokenRequest(refreshToken string, opts ...authentication.TokenOption) *authentication.TokenRequest
func SetAccount ¶
func SetAccount(accountID string) authentication.TokenOption
func SetIMSAccount ¶
func SetIMSAccount(imsAccountID string) authentication.TokenOption
func SetPhoneAuthToken ¶
func SetPhoneAuthToken(token string) authentication.TokenOption
func SetSecurityCode ¶
func SetSecurityCode(code string, vendor MFAVendor) authentication.TokenOption
func SetSecurityQuestion ¶
func SetSecurityQuestion(questionID int, answer string) authentication.TokenOption
func SetTOTPCode ¶
func SetTOTPCode(code string) authentication.TokenOption
func SetVeriSignCode ¶
func SetVeriSignCode(code string) authentication.TokenOption
Types ¶
type APIError ¶
type APIError struct { ErrorCode string `json:"errorCode"` ErrorMessage string `json:"errorMessage"` ErrorDetails string `json:"errorDetails"` Requirements Requirement `json:"requirements"` }
type Config ¶
type Config struct { IAMEndpoint string TokenEndpoint string // Optional. Default value is <IAMEndpoint>/identity/token ClientID string ClientSecret string UAAClientID string UAAClientSecret string }
func DefaultConfig ¶
type Interface ¶
type Interface interface { GetEndpoint() (*Endpoint, error) GetToken(req *authentication.TokenRequest) (*Token, error) InitiateIMSPhoneFactor(req *authentication.TokenRequest) (authToken string, err error) }
type MFAVendor ¶
type MFAVendor string
type Requirement ¶
type Token ¶
type Token struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` TokenType string `json:"token_type"` Scope string `json:"scope"` Expiry time.Time `json:"expiration"` // Fields present when ResponseTypeUAA is set UAAToken string `json:"uaa_token"` UAARefreshToken string `json:"uaa_refresh_token"` // Fields present when ResponseTypeIMS is set IMSUserID int64 `json:"ims_user_id"` IMSToken string `json:"ims_token"` }