Documentation
¶
Overview ¶
Package authorizer provides client and methods using which you can perform various graphql operations to your authorizer instance
Index ¶
- Constants
- Variables
- func CreateRandomString() string
- func EncodeB64(message string) string
- func NewStringRef(v string) *string
- func StringValue(r *string, defaultValue ...string) string
- type AuthTokenResponse
- type AuthorizerClient
- func (c *AuthorizerClient) DeactivateAccount(headers map[string]string) (*Response, error)
- func (c *AuthorizerClient) ExecuteGraphQL(req *GraphQLRequest, headers map[string]string) ([]byte, error)
- func (c *AuthorizerClient) ForgotPassword(req *ForgotPasswordRequest) (*ForgotPasswordResponse, error)
- func (c *AuthorizerClient) GetMetaData() (*MetaDataResponse, error)
- func (c *AuthorizerClient) GetProfile(headers map[string]string) (*User, error)
- func (c *AuthorizerClient) GetSession(req *SessionQueryRequest, headers map[string]string) (*AuthTokenResponse, error)
- func (c *AuthorizerClient) GetToken(req *GetTokenRequest) (*TokenResponse, error)
- func (c *AuthorizerClient) Login(req *LoginRequest) (*AuthTokenResponse, error)
- func (c *AuthorizerClient) Logout(headers map[string]string) (*Response, error)
- func (c *AuthorizerClient) MagicLinkLogin(req *MagicLinkLoginRequest) (*Response, error)
- func (c *AuthorizerClient) ResendOTP(req *ResendOTPRequest) (*Response, error)
- func (c *AuthorizerClient) ResendVerifyEmail(req *ResendVerifyEmailRequest) (*Response, error)
- func (c *AuthorizerClient) ResetPassword(req *ResetPasswordRequest) (*Response, error)
- func (c *AuthorizerClient) RevokeToken(req *RevokeTokenInput) (*Response, error)
- func (c *AuthorizerClient) SignUp(req *SignUpRequest) (*AuthTokenResponse, error)
- func (c *AuthorizerClient) UpdateProfile(req *UpdateProfileRequest, headers map[string]string) (*Response, error)
- func (c *AuthorizerClient) ValidateJWTToken(req *ValidateJWTTokenRequest) (*ValidateJWTTokenResponse, error)
- func (c *AuthorizerClient) ValidateSession(req *ValidateSessionRequest) (*ValidateSessionResponse, error)
- func (c *AuthorizerClient) VerifyEmail(req *VerifyEmailRequest) (*AuthTokenResponse, error)
- func (c *AuthorizerClient) VerifyOTP(req *VerifyOTPRequest) (*AuthTokenResponse, error)
- type ForgotPasswordInput
- type ForgotPasswordRequest
- type ForgotPasswordResponse
- type GetTokenRequest
- type GraphQLError
- type GraphQLRequest
- type GraphQLResponse
- type LoginInput
- type LoginRequest
- type MagicLinkLoginInput
- type MagicLinkLoginRequest
- type MetaDataResponse
- type ResendOTPInput
- type ResendOTPRequest
- type ResendVerifyEmailRequest
- type ResetPasswordInput
- type ResetPasswordRequest
- type Response
- type RevokeTokenInput
- type SessionQueryInput
- type SessionQueryRequest
- type SignUpInput
- type SignUpRequest
- type TokenQueryInput
- type TokenResponse
- type TokenType
- type UpdateProfileInput
- type UpdateProfileRequest
- type User
- type ValidateJWTTokenInput
- type ValidateJWTTokenRequest
- type ValidateJWTTokenResponse
- type ValidateSessionInput
- type ValidateSessionRequest
- type ValidateSessionResponse
- type VerifyEmailInput
- type VerifyEmailRequest
- type VerifyOTPInput
- type VerifyOTPRequest
Constants ¶
const ( // GrantTypeAuthorizationCode is used for authorization_code grant type GrantTypeAuthorizationCode = "authorization_code" // GrantTypeRefreshToken is used for refresh_token grant type GrantTypeRefreshToken = "refresh_token" // UserFragment defines graphql fragment for all the user attributes UserFragment = `` /* 247-byte string literal not displayed */ )
Variables ¶
var AuthTokenResponseFragment = fmt.Sprintf(`message access_token expires_in refresh_token id_token should_show_email_otp_screen should_show_mobile_otp_screen should_show_totp_screen authenticator_scanner_image authenticator_secret authenticator_recovery_codes user { %s }`, UserFragment)
AuthTokenResponseFragment defines graphql response for auth token type, which is common across various authorizer operations
Functions ¶
func CreateRandomString ¶
func CreateRandomString() string
CreateRandomString returns a random string 43 characters
func NewStringRef ¶
NewStringRef returns a reference to a string with given value
func StringValue ¶
StringValue returns the value of the given string ref
Types ¶
type AuthTokenResponse ¶
type AuthTokenResponse struct {
Message *string `json:"message,omitempty"`
AccessToken *string `json:"access_token,omitempty"`
ExpiresIn *int64 `json:"expires_in,omitempty"`
IdToken *string `json:"id_token,omitempty"`
RefreshToken *string `json:"refresh_token,omitempty"`
ShouldShowEmailOtpScreen *bool `json:"should_show_email_otp_screen"`
ShouldShowMobileOtpScreen *bool `json:"should_show_mobile_otp_screen"`
ShouldShowTotpScreen *bool `json:"should_show_totp_screen"`
AuthenticatorScannerImage *string `json:"authenticator_scanner_image"`
AuthenticatorSecret *string `json:"authenticator_secret"`
AuthenticatorRecoveryCodes []*string `json:"authenticator_recovery_codes"`
User *User `json:"user,omitempty"`
}
AuthTokenResponse defines attribute for auth token response, which is common across various authorizer operations
type AuthorizerClient ¶
type AuthorizerClient struct {
ClientID string
AuthorizerURL string
RedirectURL string
ExtraHeaders map[string]string
}
AuthorizerClient defines the attributes required to initiate authorizer client
func NewAuthorizerClient ¶
func NewAuthorizerClient(clientID, authorizerURL, redirectURL string, extraHeaders map[string]string) (*AuthorizerClient, error)
NewAuthorizerClient creates an authorizer client instance. It returns reference to authorizer client instance or error.
func (*AuthorizerClient) DeactivateAccount ¶
func (c *AuthorizerClient) DeactivateAccount(headers map[string]string) (*Response, error)
DeactivateAccount is method attached to AuthorizerClient. It performs deactivate_account mutation on authorizer instance. It returns Response reference or error. For implementation details check DeactivateAccountExample examples/deactivate_account.go
func (*AuthorizerClient) ExecuteGraphQL ¶
func (c *AuthorizerClient) ExecuteGraphQL(req *GraphQLRequest, headers map[string]string) ([]byte, error)
func (*AuthorizerClient) ForgotPassword ¶
func (c *AuthorizerClient) ForgotPassword(req *ForgotPasswordRequest) (*ForgotPasswordResponse, error)
ForgotPassword is method attached to AuthorizerClient. It performs forgot_password mutation on authorizer instance. It takes ForgotPasswordRequest reference as parameter and returns ForgotPasswordResponse reference or error.
func (*AuthorizerClient) GetMetaData ¶
func (c *AuthorizerClient) GetMetaData() (*MetaDataResponse, error)
GetMetaData is method attached to AuthorizerClient. It performs meta query on authorizer instance. It returns MetaResponse reference or error.
func (*AuthorizerClient) GetProfile ¶
func (c *AuthorizerClient) GetProfile(headers map[string]string) (*User, error)
GetProfile is method attached to AuthorizerClient. It performs profile query on authorizer instance. It returns User reference or error. For implementation details check GetProfileExample examples/get_profile.go
func (*AuthorizerClient) GetSession ¶
func (c *AuthorizerClient) GetSession(req *SessionQueryRequest, headers map[string]string) (*AuthTokenResponse, error)
GetSession is method attached to AuthorizerClient. It performs session query on authorizer instance. It returns AuthTokenResponse reference or error.
func (*AuthorizerClient) GetToken ¶
func (c *AuthorizerClient) GetToken(req *GetTokenRequest) (*TokenResponse, error)
GetToken is method attached to AuthorizerClient. It performs `/oauth/token` query on authorizer instance. It returns TokenResponse reference or error.
func (*AuthorizerClient) Login ¶
func (c *AuthorizerClient) Login(req *LoginRequest) (*AuthTokenResponse, error)
Login is method attached to AuthorizerClient. It performs login mutation on authorizer instance. It takes LoginRequest reference as parameter and returns AuthTokenResponse reference or error.
func (*AuthorizerClient) Logout ¶
func (c *AuthorizerClient) Logout(headers map[string]string) (*Response, error)
Logout is method attached to AuthorizerClient. It performs Logout mutation on authorizer instance. It takes LogoutInput reference as parameter and returns Response reference or error. For implementation details check LogoutExample examples/Logout.go
func (*AuthorizerClient) MagicLinkLogin ¶
func (c *AuthorizerClient) MagicLinkLogin(req *MagicLinkLoginRequest) (*Response, error)
MagicLinkLogin is method attached to AuthorizerClient. It performs magic_link_login mutation on authorizer instance. It takes MagicLinkLoginRequest reference as parameter and returns Response reference or error.
func (*AuthorizerClient) ResendOTP ¶
func (c *AuthorizerClient) ResendOTP(req *ResendOTPRequest) (*Response, error)
ResendOTP is method attached to AuthorizerClient. It performs resend_otp mutation on authorizer instance. It takes ResendOTPRequest reference as parameter and returns Response reference or error.
func (*AuthorizerClient) ResendVerifyEmail ¶
func (c *AuthorizerClient) ResendVerifyEmail(req *ResendVerifyEmailRequest) (*Response, error)
ResendVerifyEmail is method attached to AuthorizerClient. It performs resend_verify_email mutation on authorizer instance. It takes ResendVerifyEmailRequest reference as parameter and returns Response reference or error.
func (*AuthorizerClient) ResetPassword ¶
func (c *AuthorizerClient) ResetPassword(req *ResetPasswordRequest) (*Response, error)
ResetPassword is method attached to AuthorizerClient. It performs reset_password mutation on authorizer instance. It takes ResetPasswordRequest reference as parameter and returns Response reference or error.
func (*AuthorizerClient) RevokeToken ¶
func (c *AuthorizerClient) RevokeToken(req *RevokeTokenInput) (*Response, error)
RevokeToken is method attached to AuthorizerClient. It performs /oauth/revoke api call on authorizer instance. It takes RevokeTokenInput reference as parameter and returns Response reference or error.
func (*AuthorizerClient) SignUp ¶
func (c *AuthorizerClient) SignUp(req *SignUpRequest) (*AuthTokenResponse, error)
SignUp is method attached to AuthorizerClient. It performs signup mutation on authorizer instance. It takes SignUpRequest reference as parameter and returns AuthTokenResponse reference or error.
func (*AuthorizerClient) UpdateProfile ¶
func (c *AuthorizerClient) UpdateProfile(req *UpdateProfileRequest, headers map[string]string) (*Response, error)
UpdateProfile is method attached to AuthorizerClient. It performs update_profile mutation on authorizer instance. It returns Response reference or error.
func (*AuthorizerClient) ValidateJWTToken ¶
func (c *AuthorizerClient) ValidateJWTToken(req *ValidateJWTTokenRequest) (*ValidateJWTTokenResponse, error)
ValidateJWTToken is method attached to AuthorizerClient. It performs validate_jwt_token query on authorizer instance. It returns ValidateJWTTokenResponse reference or error.
func (*AuthorizerClient) ValidateSession ¶
func (c *AuthorizerClient) ValidateSession(req *ValidateSessionRequest) (*ValidateSessionResponse, error)
ValidateSession is method attached to AuthorizerClient. It performs validate_session query on authorizer instance. It returns ValidateSessionResponse reference or error.
func (*AuthorizerClient) VerifyEmail ¶
func (c *AuthorizerClient) VerifyEmail(req *VerifyEmailRequest) (*AuthTokenResponse, error)
VerifyEmail is method attached to AuthorizerClient. It performs verify_email mutation on authorizer instance. It returns AuthTokenResponse reference or error.
func (*AuthorizerClient) VerifyOTP ¶
func (c *AuthorizerClient) VerifyOTP(req *VerifyOTPRequest) (*AuthTokenResponse, error)
VerifyOTP is method attached to AuthorizerClient. It performs verify_otp mutation on authorizer instance. It returns AuthTokenResponse reference or error.
type ForgotPasswordInput ¶
type ForgotPasswordInput = ForgotPasswordRequest
ForgotPasswordInput is deprecated: Use ForgotPasswordRequest instead
type ForgotPasswordRequest ¶
type ForgotPasswordRequest struct {
Email *string `json:"email,omitempty"`
PhoneNumber *string `json:"phone_number,omitempty"`
State *string `json:"state,omitempty"`
RedirectURI *string `json:"redirect_uri,omitempty"`
}
ForgotPasswordRequest defines attributes for forgot_password request
type ForgotPasswordResponse ¶
type ForgotPasswordResponse struct {
Message string `json:"message"`
ShouldShowMobileOtpScreen *bool `json:"should_show_mobile_otp_screen"`
}
ForgotPasswordResponse defines attribute for forgot_password response
type GetTokenRequest ¶
type GetTokenRequest struct {
Code *string `json:"code"`
GrantType *string `json:"grant_type"`
RefreshToken *string `json:"refresh_token"`
}
GetTokenRequest defines attributes for token request
type GraphQLError ¶
type GraphQLRequest ¶
type GraphQLRequest struct {
Query string `json:"query"`
Variables map[string]interface{} `json:"variables,omitempty"`
}
GraphQLRequest is object used to make graphql queries
type GraphQLResponse ¶
type GraphQLResponse struct {
Errors []*GraphQLError `json:"errors"`
Data interface{} `json:"data"`
}
type LoginRequest ¶
type LoginRequest struct {
Email *string `json:"email,omitempty"`
PhoneNumber *string `json:"phone_number,omitempty"`
Password string `json:"password"`
Roles []*string `json:"roles,omitempty"`
Scope []*string `json:"scope,omitempty"`
State *string `json:"state,omitempty"`
}
LoginRequest defines attributes for login request
type MagicLinkLoginInput ¶
type MagicLinkLoginInput = MagicLinkLoginRequest
MagicLinkLoginInput is deprecated: Use MagicLinkLoginRequest instead
type MagicLinkLoginRequest ¶
type MagicLinkLoginRequest struct {
Email string `json:"email"`
Roles []*string `json:"roles,omitempty"`
Scope []*string `json:"scope,omitempty"`
State *string `json:"state"`
RedirectURI *string `json:"redirect_uri"`
}
MagicLinkLoginRequest defines attributes for magic link login request
type MetaDataResponse ¶
type MetaDataResponse struct {
Version string `json:"version"`
ClientID string `json:"client_id"`
IsGoogleLoginEnabled bool `json:"is_google_login_enabled"`
IsFacebookLoginEnabled bool `json:"is_facebook_login_enabled"`
IsGithubLoginEnabled bool `json:"is_github_login_enabled"`
IsLinkedinLoginEnabled bool `json:"is_linkedin_login_enabled"`
IsAppleLoginEnabled bool `json:"is_apple_login_enabled"`
IsTwitterLoginEnabled bool `json:"is_twitter_login_enabled"`
IsDiscordLoginEnabled bool `json:"is_discord_login_enabled"`
IsMicrosoftLoginEnabled bool `json:"is_microsoft_login_enabled"`
IsTwitchLoginEnabled bool `json:"is_twitch_login_enabled"`
IsRobloxLoginEnabled bool `json:"is_roblox_login_enabled"`
IsEmailVerificationEnabled bool `json:"is_email_verification_enabled"`
IsBasicAuthenticationEnabled bool `json:"is_basic_authentication_enabled"`
IsMagicLinkLoginEnabled bool `json:"is_magic_link_login_enabled"`
IsSignUpEnabled bool `json:"is_sign_up_enabled"`
IsStrongPasswordEnabled bool `json:"is_strong_password_enabled"`
IsMultiFactorAuthEnabled bool `json:"is_multi_factor_auth_enabled"`
IsMobileBasicAuthenticationEnabled bool `json:"is_mobile_basic_authentication_enabled"`
IsPhoneVerificationEnabled bool `json:"is_phone_verification_enabled"`
}
MetaDataResponse defines attributes for MetaData response query
type ResendOTPInput ¶
type ResendOTPInput = ResendOTPRequest
ResendOTPInput is deprecated: Use ResendOTPRequest instead
type ResendOTPRequest ¶
type ResendOTPRequest struct {
Email *string `json:"email"`
PhoneNumber *string `json:"phone_number"`
State *string `json:"state,omitempty"`
}
ResendOTPRequest defines attributes for resend_otp request
type ResendVerifyEmailRequest ¶
type ResendVerifyEmailRequest struct {
Email string `json:"email"`
Identifier *string `json:"identifier,omitempty"`
}
ResendVerifyEmailRequest defines attributes for resend_verify_email request
type ResetPasswordInput ¶
type ResetPasswordInput = ResetPasswordRequest
ResetPasswordInput is deprecated: Use ResetPasswordRequest instead
type ResetPasswordRequest ¶
type ResetPasswordRequest struct {
Token *string `json:"token,omitempty"`
Password string `json:"password"`
ConfirmPassword string `json:"confirm_password"`
OTP *string `json:"otp,omitempty"`
PhoneNumber *string `json:"phone_number,omitempty"`
}
ResetPasswordRequest defines attributes for reset_password request
type Response ¶
type Response struct {
Message string `json:"message"`
}
Response defines attribute for Response graphql type it is common across various authorizer operations
type RevokeTokenInput ¶
type RevokeTokenInput struct {
RefreshToken string `json:"refresh_token"`
}
RevokeTokenInput defines attributes for /oauth/revoke request
type SessionQueryInput ¶
type SessionQueryInput = SessionQueryRequest
SessionQueryInput is deprecated: Use SessionQueryRequest instead
type SessionQueryRequest ¶
type SessionQueryRequest struct {
Roles []*string `json:"roles"`
Scope []*string `json:"scope,omitempty"`
}
SessionQueryRequest defines attributes for session query request
type SignUpInput ¶
type SignUpInput = SignUpRequest
SignUpInput is deprecated: Use SignUpRequest instead
type SignUpRequest ¶
type SignUpRequest struct {
Email *string `json:"email,omitempty"`
Password string `json:"password"`
ConfirmPassword string `json:"confirm_password"`
GivenName *string `json:"given_name,omitempty"`
FamilyName *string `json:"family_name,omitempty"`
MiddleName *string `json:"middle_name,omitempty"`
NickName *string `json:"nick_name,omitempty"`
Picture *string `json:"picture,omitempty"`
Gender *string `json:"gender,omitempty"`
BirthDate *string `json:"birthdate,omitempty"`
PhoneNumber *string `json:"phone_number,omitempty"`
Roles []*string `json:"roles,omitempty"`
Scope []*string `json:"scope,omitempty"`
RedirectURI *string `json:"redirect_uri,omitempty"`
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled,omitempty"`
AppData map[string]interface{} `json:"app_data,omitempty"`
State *string `json:"state,omitempty"`
}
SignUpRequest defines attributes for signup request
type TokenQueryInput ¶
type TokenQueryInput = GetTokenRequest
TokenQueryInput is deprecated: Use GetTokenRequest instead
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int64 `json:"expires_in"`
IdToken string `json:"id_token"`
RefreshToken *string `json:"refresh_token"`
}
TokenResponse defines attributes for token request
type UpdateProfileInput ¶
type UpdateProfileInput = UpdateProfileRequest
UpdateProfileInput is deprecated: Use UpdateProfileRequest instead
type UpdateProfileRequest ¶
type UpdateProfileRequest struct {
Email *string `json:"email,omitempty"`
NewPassword *string `json:"new_password,omitempty"`
ConfirmNewPassword *string `json:"confirm_new_password,omitempty"`
OldPassword *string `json:"old_password,omitempty"`
GivenName *string `json:"given_name,omitempty"`
FamilyName *string `json:"family_name,omitempty"`
MiddleName *string `json:"middle_name,omitempty"`
NickName *string `json:"nick_name,omitempty"`
Picture *string `json:"picture,omitempty"`
Gender *string `json:"gender,omitempty"`
BirthDate *string `json:"birthdate,omitempty"`
PhoneNumber *string `json:"phone_number,omitempty"`
Roles []*string `json:"roles,omitempty"`
Scope []*string `json:"scope,omitempty"`
RedirectURI *string `json:"redirect_uri,omitempty"`
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled,omitempty"`
AppData map[string]interface{} `json:"app_data,omitempty"`
}
UpdateProfileRequest defines attributes for update_profile request
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
PreferredUsername string `json:"preferred_username"`
EmailVerified bool `json:"email_verified"`
SignupMethods string `json:"signup_methods"`
GivenName *string `json:"given_name"`
FamilyName *string `json:"family_name"`
MiddleName *string `json:"middle_name"`
Nickname *string `json:"nickname"`
Picture *string `json:"picture"`
Gender *string `json:"gender"`
Birthdate *string `json:"birthdate"`
PhoneNumber *string `json:"phone_number"`
PhoneNumberVerified *bool `json:"phone_number_verified"`
Roles []*string `json:"roles"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled"`
AppData map[string]interface{} `json:"app_data,omitempty"`
RevokedTimestamp *int64 `json:"revoked_timestamp"`
}
User defines attributes for user instance
type ValidateJWTTokenInput ¶
type ValidateJWTTokenInput = ValidateJWTTokenRequest
ValidateJWTTokenInput is deprecated: Use ValidateJWTTokenRequest instead
type ValidateJWTTokenRequest ¶
type ValidateJWTTokenRequest struct {
TokenType TokenType `json:"token_type"`
Token string `json:"token"`
Roles []*string `json:"roles,omitempty"`
}
ValidateJWTTokenRequest defines attributes for validate_jwt_token request
type ValidateJWTTokenResponse ¶
type ValidateJWTTokenResponse struct {
IsValid bool `json:"is_valid"`
Claims map[string]interface{} `json:"claims"`
}
ValidateJWTTokenResponse defines attributes for validate_jwt_token response
type ValidateSessionInput ¶
type ValidateSessionInput = ValidateSessionRequest
ValidateSessionInput is deprecated: Use ValidateSessionRequest instead
type ValidateSessionRequest ¶
type ValidateSessionRequest struct {
Cookie string `json:"cookie,omitempty"`
Roles []*string `json:"roles,omitempty"`
}
ValidateSessionRequest defines attributes for validate_session request
type ValidateSessionResponse ¶
type ValidateSessionResponse struct {
IsValid bool `json:"is_valid"`
User *User `json:"user,omitempty"`
}
ValidateSessionResponse defines attributes for validate_session response
type VerifyEmailInput ¶
type VerifyEmailInput = VerifyEmailRequest
VerifyEmailInput is deprecated: Use VerifyEmailRequest instead
type VerifyEmailRequest ¶
type VerifyEmailRequest struct {
Token string `json:"token"`
State *string `json:"state,omitempty"`
}
VerifyEmailRequest defines attributes for verify_email request
type VerifyOTPInput ¶
type VerifyOTPInput = VerifyOTPRequest
VerifyOTPInput is deprecated: Use VerifyOTPRequest instead
Source Files
¶
- client.go
- common.go
- deactivate_account.go
- forgot_password.go
- get_meta_data.go
- get_profile.go
- get_session.go
- get_token.go
- graphql.go
- login.go
- logout.go
- magic_link_login.go
- resend_otp.go
- resend_verify_email.go
- reset_password.go
- revoke_token.go
- signup.go
- update_profile.go
- utils.go
- validate_jwt_token.go
- validate_session.go
- verify_email.go
- verify_otp.go
