authing_v2

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertAppModel

func ConvertAppModel(m *model.Application) *authing_model.Application

func ConvertTenantDetailModel

func ConvertTenantDetailModel(m *model.TenantDetails) *authing_model.TenantDetails

func ConvertTenantModel

func ConvertTenantModel(m *model.Tenant) *authing_model.Tenant

func NewAuthingAuthCli

func NewAuthingAuthCli(UserPoolId, appId, appSecret, appHost, appRedirectUri, appLogoutRedirectUri, accessToken string) *authentication.Client

func NewAuthingMgmtCli

func NewAuthingMgmtCli(userPoolId string, authingHost string, useEnvHost bool) *management.Client

func SendHttpRestRequest_fix

func SendHttpRestRequest_fix(c *management.Client, host, url string, method string, rawReq interface{}, appId string, tenantId string, userPoolId string) ([]byte, error)

default no need to add bearer token

func SendHttpRestRequest_fix2

func SendHttpRestRequest_fix2(url string, method string, rawReq interface{}, appId string, tenantId string, userPoolId string) ([]byte, error)

func SendHttpRestRequest_with_auth

func SendHttpRestRequest_with_auth(url string, method string, appId string, tenantId string, userPoolId string, authorization string) ([]byte, error)

Types

type AppComponentGlobalPublicConfigModel

type AppComponentGlobalPublicConfigModel struct {
	ShowChangeLanguage bool   `json:"showChangeLanguage"`
	DefaultLanguage    string `json:"defaultLanguage"` // browser
}

type AppComponentPublicConfigModel

type AppComponentPublicConfigModel struct {
	Global *AppComponentGlobalPublicConfigModel `json:"global"`
}

type AppPublicConfigModel

type AppPublicConfigModel struct {
	AllowedOrigins []string `json:"allowedOrigins"`
	// [
	//         "https://core.authing.cn",
	//         "https://*.authing.cn",
	//         "https://*.authing.co"
	//  ],
	CorsWhitelist                   []string                    `json:"corsWhitelist"`
	UserPoolInWhitelist             bool                        `json:"userPoolInWhitelist"`
	SkipComplateFileds              bool                        `json:"skipComplateFileds"`
	ComplateFiledsPlace             interface{}                 `json:"complateFiledsPlace"` // []
	ExtendsFields                   interface{}                 `json:"extendsFields"`       // []
	ExtendsFieldsEnabled            bool                        `json:"extendsFieldsEnabled"`
	ExtendsFieldsI18n               interface{}                 `json:"extendsFieldsI18n"`
	CdnBase                         string                      `json:"cdnBase"` // https://files.authing.co/authing-user-portal, for request svg icons:/svg-string/guard
	ID                              string                      `json:"id"`      // "6376f1472fee799ab3c3399b",
	Template                        interface{}                 `json:"template"`
	UserPoolId                      string                      `json:"userPoolId"`
	Description                     string                      `json:"description"`
	Identifier                      string                      `json:"identifier"`
	ShowAuthorizationPage           bool                        `json:"showAuthorizationPage"`
	PublicKey                       string                      `json:"publicKey"`
	Name                            string                      `json:"name"`               // "SASE Console",
	CSS                             string                      `json:"css"`                // "",
	UserpoolName                    string                      `json:"userpoolName"`       // "CitrusSec",
	SelfUnlockStrategy              string                      `json:"selfUnlockStrategy"` // "password-captcha",
	SSOPageComponentDisplay         interface{}                 `json:"ssoPageComponentDisplay"`
	RegisterDisabled                bool                        `json:"registerDisabled"`
	LoginTabs                       LoginTabsModel              `json:"loginTabs"`
	QrcodeTabsSettings              interface{}                 `json:"qrcodeTabsSettings"`
	RegisterTabs                    LoginTabsModel              `json:"registerTabs"`
	SocialConnections               interface{}                 `json:"socialConnections"`
	EcConnections                   interface{}                 `json:"ecConnections"`
	IdentityProviders               []AuthingIdentityProvider   `json:"identityProviders"`
	RedirectUris                    []string                    `json:"redirectUris"`
	LogoutRedirectUris              []string                    `json:"logoutRedirectUris"`
	Protocol                        string                      `json:"protocol"`
	OidcConfig                      interface{}                 `json:"oidcConfig"`
	OauthConfig                     interface{}                 `json:"oauthConfig"`
	SamlConfig                      interface{}                 `json:"samlConfig"`
	CasConfig                       interface{}                 `json:"casConfig"`
	RootUserPoolId                  string                      `json:"rootUserPoolId"`
	EnableSubAccount                bool                        `json:"enableSubAccount"`
	PackageType                     int32                       `json:"packageType"`
	CustomBrandingEnabled           bool                        `json:"customBrandingEnabled"`
	UserPortal                      interface{}                 `json:"userPortal"`
	Websocket                       string                      `json:"websocket"`   // "https://core.authing.cn",
	EventSocket                     string                      `json:"eventSocket"` // "wss://openevent.authing.cn",
	DeviceFuncEnabled               bool                        `json:"deviceFuncEnabled"`
	VerifyCodeLength                int32                       `json:"verifyCodeLength"`
	AgreementEnabled                bool                        `json:"agreementEnabled"`
	Agreements                      interface{}                 `json:"agreements"` // []
	PasswordStrength                int32                       `json:"passwordStrength"`
	CustomPasswordStrength          interface{}                 `json:"customPasswordStrength"`
	API                             AuthingPublicConfigAPIModel `json:"api"`
	LoginFailCheckEnabled           interface{}                 `json:"loginFailCheckEnabled"`
	PasswordTabConfig               interface{}                 `json:"passwordTabConfig"`
	VerifyCodeTabConfig             interface{}                 `json:"verifyCodeTabConfig"`
	AuthingOtpPushTabConfig         interface{}                 `json:"authingOtpPushTabConfig"`
	ChangeEmailStrategy             interface{}                 `json:"changeEmailStrategy"`
	ChangePhoneStrategy             interface{}                 `json:"changePhoneStrategy"`
	UserPoolType                    string                      `json:"userPoolType"`
	SceneCode                       string                      `json:"sceneCode"`
	WelcomeMessage                  map[string]interface{}      `json:"welcomeMessage"`
	Docs                            interface{}                 `json:"docs"`
	RequestHostname                 string                      `json:"requestHostname"` // citrus-console.authing.cn
	CustomLoading                   interface{}                 `json:"customLoading"`
	InternationalSmsConfig          interface{}                 `json:"internationalSmsConfig"`
	LoadingBackground               interface{}                 `json:"loadingBackground"`
	Asa                             interface{}                 `json:"asa"`
	EnableCompletePassword          bool                        `json:"enableCompletePassword"`
	EnableLoginAccountSwitch        bool                        `json:"enableLoginAccountSwitch"`
	AppType                         string                      `json:"appType"` // "spa",
	EnableAppLogin                  bool                        `json:"enableAppLogin"`
	EnableFaceLogin                 bool                        `json:"enableFaceLogin"`
	EnableFingerprintLogin          bool                        `json:"enableFingerprintLogin"`
	LivingAuthSortConfig            interface{}                 `json:"livingAuthSortConfig"` // null
	EnableUnionDomain               bool                        `json:"enableUnionDomain"`
	SsoEnabled                      bool                        `json:"ssoEnabled"`
	IsTenantConsole                 bool                        `json:"isTenantConsole"`
	IsTenantDefault                 bool                        `json:"isTenantDefault"`
	Custom                          interface{}                 `json:"custom"`
	QrCodeSortConfig                interface{}                 `json:"qrCodeSortConfig"`
	SelfServiceCancellationSettings interface{}                 `json:"selfServiceCancellationSettings"`
	TabMethodsFields                interface{}                 `json:"tabMethodsFields"`
	EnableVerifyDomainInJoinTenant  bool                        `json:"enableVerifyDomainInJoinTenant"`
	EnableCreateTenant              bool                        `json:"enableCreateTenant"`
	EnableJoinTenant                bool                        `json:"enableJoinTenant"`
	EnableSwitchTenant              bool                        `json:"enableSwitchTenant"`
	EnableVerifyDomain              bool                        `json:"enableVerifyDomain"`
	RegexRules                      interface{}                 `json:"regexRules"`
	CustomScope                     interface{}                 `json:"customScope"`
	EnabledAuthnWorkflow            bool                        `json:"enabledAuthnWorkflow"`
	EnabledRegistryAuthnWorkflow    bool                        `json:"enabledRegistryAuthnWorkflow"`
	EnabledLoginAuthnWorkflow       bool                        `json:"enabledLoginAuthnWorkflow"`
	EnabledResetPwdAuthnWorkflow    bool                        `json:"enabledResetPwdAuthnWorkflow"`
	DefaultAppId                    string                      `json:"defaultAppId"`
	Posthog                         interface{}                 `json:"posthog"`
	Mfa                             interface{}                 `json:"mfa"`
}

type AuthingAuthCli

type AuthingAuthCli struct {
	UserPoolId  string
	AppId       string
	AppSecret   string
	AppHost     string
	AccessToken string
	Cli         *authentication.Client
}

func (*AuthingAuthCli) BuildAuthorizeUrlByOidc

func (a *AuthingAuthCli) BuildAuthorizeUrlByOidc(params model.OidcParams, tenantId *string) (string, error)

hack

func (*AuthingAuthCli) BuildClientAuthUrl

func (a *AuthingAuthCli) BuildClientAuthUrl(appHost, state, redirectUri string, tenantId *string) string

func (*AuthingAuthCli) BuildLogoutUrl

func (a *AuthingAuthCli) BuildLogoutUrl(redirectUri string, idToken *string) string

func (*AuthingAuthCli) GetAccessTokenByCode

func (a *AuthingAuthCli) GetAccessTokenByCode(code, redirectUri string) (string, error)

func (*AuthingAuthCli) GetUserInfoByAccessToken

func (a *AuthingAuthCli) GetUserInfoByAccessToken(code string) (*authing_model.AuthingSessionUserInfo, error)

func (*AuthingAuthCli) ResetAuthCli

func (a *AuthingAuthCli) ResetAuthCli(UserPoolId, appId, appSecret, appHost, appRedirectUri, appLogoutRedirectUri, accessToken string)

func (*AuthingAuthCli) RevokeToken

func (a *AuthingAuthCli) RevokeToken(token string) error

please reset cli before call this

func (*AuthingAuthCli) SetAccessToken

func (a *AuthingAuthCli) SetAccessToken(token string)

func (*AuthingAuthCli) ValidateToken

func (a *AuthingAuthCli) ValidateToken(idToken string) (string, error)

type AuthingCli

type AuthingCli struct {
	UserPoolId  string
	TenantId    *string // no need to v2
	Cli         *management.Client
	AuthingHost string
	UseEnvHost  bool
	// for app
	AuthCli *AuthingAuthCli
}

func NewAuthingCli

func NewAuthingCli() *AuthingCli

func (*AuthingCli) ActiveUser

func (a *AuthingCli) ActiveUser(id *string) error

func (*AuthingCli) AddTenantMembers

func (a *AuthingCli) AddTenantMembers(tenantId, userId *string) error

func (*AuthingCli) AddUserToGroup

func (a *AuthingCli) AddUserToGroup(userId *string, groupCode string) error

func (*AuthingCli) AutoJoinUserToTenant

func (a *AuthingCli) AutoJoinUserToTenant(idpId string, enable bool, tenantId string) error

func (*AuthingCli) BatchDeleteUser

func (a *AuthingCli) BatchDeleteUser(ids []string) (bool, error)

func (*AuthingCli) BuildAuthorizeUrlByOidc

func (a *AuthingCli) BuildAuthorizeUrlByOidc(params model.OidcParams, tenantId *string) (string, error)

hack

func (*AuthingCli) BuildClientAuthUrl

func (a *AuthingCli) BuildClientAuthUrl(appHost, state, redirectUri string, tenantId *string) string

func (*AuthingCli) BuildLogoutUrl

func (a *AuthingCli) BuildLogoutUrl(redirectUri string, idToken *string) string

func (*AuthingCli) ChangeAppMfa

func (a *AuthingCli) ChangeAppMfa(appId string, factor string, enable bool) error

SMS,OTP,EMAIL

func (*AuthingCli) ChangeGlobalMfa

func (a *AuthingCli) ChangeGlobalMfa(factor string, enable bool) error

SMS,OTP,EMAIL

func (*AuthingCli) ChangeIdpConnMfa

func (a *AuthingCli) ChangeIdpConnMfa(extConnId string, factor string, enable bool) error

func (*AuthingCli) ChangeIdpConnectionMfa4Tenant

func (a *AuthingCli) ChangeIdpConnectionMfa4Tenant(idpConnectionId string, tenantId string, EnabledFactors []string) error

func (*AuthingCli) ChangeIdpConnectionState4App

func (a *AuthingCli) ChangeIdpConnectionState4App(idpConnectionId string, enable bool) error

func (*AuthingCli) ChangeIdpConnectionState4Tenant

func (a *AuthingCli) ChangeIdpConnectionState4Tenant(idpConnectionId string, enable bool, tenantId string, isCreate bool) error

func (*AuthingCli) CreateApp

func (*AuthingCli) CreateIdp

func (a *AuthingCli) CreateIdp(name, idpType string) (string, error)

func (*AuthingCli) CreateIdp4Tenant

func (a *AuthingCli) CreateIdp4Tenant(name, idpType, tenantId string) (string, error)

func (*AuthingCli) CreateIdpConnection

func (a *AuthingCli) CreateIdpConnection(idpId string, connType string, identifier string, displayName string, fields interface{}) (string, error)

func (*AuthingCli) CreateIdpConnection4Tenant

func (a *AuthingCli) CreateIdpConnection4Tenant(idpId string, tenantId string, connType string, identifier string, displayName string, fields interface{}) (string, error)

func (*AuthingCli) CreateTenant

func (*AuthingCli) CreateUser

func (*AuthingCli) DeActiveUser

func (a *AuthingCli) DeActiveUser(id *string) error

func (*AuthingCli) DelApp

func (a *AuthingCli) DelApp(appId string) error

func (*AuthingCli) DeleteIdp

func (a *AuthingCli) DeleteIdp(idpId string) error

func (*AuthingCli) DeleteIdp4Tenant

func (a *AuthingCli) DeleteIdp4Tenant(idpId string, tenantId string) error

func (*AuthingCli) DeleteIdpConnection

func (a *AuthingCli) DeleteIdpConnection(idpConnectionId string) error

func (*AuthingCli) DeleteIdpConnection4Tenant

func (a *AuthingCli) DeleteIdpConnection4Tenant(idpConnectionId string, tenantId string) error

func (*AuthingCli) DeleteUser

func (a *AuthingCli) DeleteUser(id *string) (bool, error)

func (*AuthingCli) FindApp

func (a *AuthingCli) FindApp() *authing_model.Application

func (*AuthingCli) FindAppById

func (a *AuthingCli) FindAppById(appId string) *authing_model.Application

func (*AuthingCli) FindUserWhenLogin

func (a *AuthingCli) FindUserWhenLogin(appId, tenantId, key, loginType string) (interface{}, error)

func (*AuthingCli) GetAccessTokenByCode

func (a *AuthingCli) GetAccessTokenByCode(code, redirectUri string) (string, error)

func (*AuthingCli) GetAppComponentPublicConfig

func (a *AuthingCli) GetAppComponentPublicConfig(appId string, tenantId string) (interface{}, error)

func (*AuthingCli) GetAppHost

func (a *AuthingCli) GetAppHost() string

func (*AuthingCli) GetAppId

func (a *AuthingCli) GetAppId() string

func (*AuthingCli) GetAppPublicConfig

func (a *AuthingCli) GetAppPublicConfig(appId string, tenantId string) (interface{}, error)

func (*AuthingCli) GetAppTenantList

func (a *AuthingCli) GetAppTenantList() (list *[]authing_model.TenantDetails, err error)

func (*AuthingCli) GetCheckAppIsShowCode

func (a *AuthingCli) GetCheckAppIsShowCode(appId string, tenantId string) (interface{}, error)

func (*AuthingCli) GetGroupList

func (a *AuthingCli) GetGroupList(page int, limit int) (list *[]authing_model.GroupModel)

func (*AuthingCli) GetGroupUsers

func (a *AuthingCli) GetGroupUsers(code string, page, limit int, userMap map[string]bool, groupUserMap map[string][]string) (cnt int)

func (*AuthingCli) GetLoginStatus

func (a *AuthingCli) GetLoginStatus(appId, tenantId string, payload interface{}) (interface{}, error)

func (*AuthingCli) GetMeInfo

func (a *AuthingCli) GetMeInfo(appId, tenantId, authorization string) (interface{}, error)

func (*AuthingCli) GetTenantList

func (a *AuthingCli) GetTenantList() (list *[]authing_model.Tenant)

获取用户池下租户列表

func (*AuthingCli) GetTenantMembers

func (a *AuthingCli) GetTenantMembers(tenantId *string, userMap map[string]bool, tenantUserMap map[string][]string) (list *[]model.User)

func (*AuthingCli) GetUser

func (a *AuthingCli) GetUser(userId *string) (*authing_model.User, error)

with_custom_data=true&with_identities=true&withUserSource=true

func (*AuthingCli) GetUserIdByAccessToken

func (a *AuthingCli) GetUserIdByAccessToken(code string) (string, error)

func (*AuthingCli) GetUserInfoByAccessToken

func (a *AuthingCli) GetUserInfoByAccessToken(code string) (*authing_model.AuthingSessionUserInfo, error)

func (*AuthingCli) GetUserList

func (a *AuthingCli) GetUserList(page int, limit int) (list *[]authing_model.User)

func (*AuthingCli) PostAccountLogin

func (a *AuthingCli) PostAccountLogin(appId, tenantId string, payload interface{}) (interface{}, error)

func (*AuthingCli) PostEmailCodeLogin

func (a *AuthingCli) PostEmailCodeLogin(appId, tenantId string, payload interface{}) (interface{}, error)

func (*AuthingCli) PostGraphqlV2

func (a *AuthingCli) PostGraphqlV2(appId string, tenantId string, payload any) (interface{}, error)

payload is GraphqlV2Req

func (*AuthingCli) PostPhoneCodeLogin

func (a *AuthingCli) PostPhoneCodeLogin(appId, tenantId string, payload interface{}) (interface{}, error)

func (*AuthingCli) PrintOptions

func (a *AuthingCli) PrintOptions()

func (*AuthingCli) RemoveTenant

func (a *AuthingCli) RemoveTenant(tenantId *string) (*string, error)

func (*AuthingCli) ResetAuthCli

func (a *AuthingCli) ResetAuthCli(appId, appSecret, appHost, appRedirectUri, appLogoutRedirectUri, accessToken string)

func (*AuthingCli) ResetCliTenantId

func (a *AuthingCli) ResetCliTenantId(tenantId string)

func (*AuthingCli) RevokeToken

func (a *AuthingCli) RevokeToken(token string) error

func (*AuthingCli) SendAuthingRequest

func (a *AuthingCli) SendAuthingRequest(url string, httpMethod string, req interface{}) error

func (*AuthingCli) SendEmailWhenLogin

func (a *AuthingCli) SendEmailWhenLogin(appId, tenantId string, payload interface{}) (interface{}, error)

func (*AuthingCli) SendFirstLoginVerifyEmail

func (a *AuthingCli) SendFirstLoginVerifyEmail(userId *string) error

func (*AuthingCli) SendSmsWhenLogin

func (a *AuthingCli) SendSmsWhenLogin(appId, tenantId string, payload interface{}) (interface{}, error)

func (*AuthingCli) SetAccessToken

func (a *AuthingCli) SetAccessToken(token string)

func (*AuthingCli) UpdateApp

func (*AuthingCli) UpdateAppMfa

func (a *AuthingCli) UpdateAppMfa(enabledFactors []string, disabledFactors []string) []string

func (*AuthingCli) UpdateApp_fix

func (a *AuthingCli) UpdateApp_fix(appId string, loginCfg *authing_model.MyAuthingLoginConfig) (bool, error)

passwordMethods = "phone-password", "email-password", "username-password" codeMethods = phone-code, email-code

func (*AuthingCli) UpdateIdp

func (a *AuthingCli) UpdateIdp(idpId string, name string) error

func (*AuthingCli) UpdateIdp4Tenant

func (a *AuthingCli) UpdateIdp4Tenant(idpId string, tenantId string, name string) error

func (*AuthingCli) UpdateIdpConnection

func (a *AuthingCli) UpdateIdpConnection(idpConnectionId string, displayName string, fields interface{}) error

func (*AuthingCli) UpdateIdpConnection4Tenant

func (a *AuthingCli) UpdateIdpConnection4Tenant(idpConnectionId string, tenantId string, displayName string, fields interface{}) error

func (*AuthingCli) UpdateTenant

func (a *AuthingCli) UpdateTenant(id *string, tenantInfo *authing_model.CreateTenantRequest) (bool, error)

func (*AuthingCli) UpdateTenant_ExtraInfo

func (a *AuthingCli) UpdateTenant_ExtraInfo(tenantId string, request *authing_model.UpdateTenantExtraReq) (bool, error)

func (*AuthingCli) UpdateTenant_loginPage

func (a *AuthingCli) UpdateTenant_loginPage(tenantId string, loginCfg *authing_model.MyAuthingLoginConfig) error

func (*AuthingCli) UpdateUser

func (a *AuthingCli) UpdateUser(id *string, user *authing_model.UpdateUserInput) error

func (*AuthingCli) ValidateToken

func (a *AuthingCli) ValidateToken(idToken string) (string, error)

type AuthingIdentityProvider

type AuthingIdentityProvider struct {
	AssociationMode         string                        `json:"associationMode"`
	BindOnly                bool                          `json:"bindOnly"`
	ChallengeBindingMethods []string                      `json:"challengeBindingMethods"`
	Config                  AuthingIdentityProviderConfig `json:"config"`
	CreatedAt               string                        `json:"createdAt"`
	DisplayName             string                        `json:"displayName"`
	Enabled                 bool                          `json:"enabled"`
	ExtIdpId                string                        `json:"extIdpId"`
	Fields                  interface{}                   `json:"fields"`
	Id                      string                        `json:"id"`
	Identifier              string                        `json:"identifier"`
	Protocol                string                        `json:"protocol"`
	TenantId                string                        `json:"tenantId"`
	UserPoolId              string                        `json:"userPoolId"`
	LoginOnly               bool                          `json:"loginOnly"`
	SkipMfa                 bool                          `json:"skipMfa"`
	UserMatchFields         []string                      `json:"userMatchFields"`
}

type AuthingIdentityProviderConfig

type AuthingIdentityProviderConfig struct {
	AuthorizationDomain  string `json:"authorizationDomain"`
	AuthorizationUrl     string `json:"authorizationUrl"`
	CallbackUrl          string `json:"callbackUrl"`
	ClientId             string `json:"clientId"`
	EmailVerifiedDefault bool   `json:"emailVerifiedDefault"`
	IsOpenQrcodeAuth     bool   `json:"isOpenQrcodeAuth"`
	Prompt               string `json:"prompt"`
	RedirectUrl          string `json:"redirectUrl"`
	Tenant               string `json:"tenant"`
}

type AuthingPublicConfigAPIHeadersModel

type AuthingPublicConfigAPIHeadersModel struct {
	Keys map[string]string `json:"keys"`
}

type AuthingPublicConfigAPIModel

type AuthingPublicConfigAPIModel struct {
	Headers AuthingPublicConfigAPIHeadersModel `json:"headers"`
}

type GraphqlV2Req

type GraphqlV2Req struct {
	Query     string      `json:"query"`
	Variables interface{} `json:"variables"`
}

type LoginTabsModel

type LoginTabsModel struct {
	List       []string               `json:"list"`
	DefaultTab string                 `json:"default"`
	Title      map[string]interface{} `json:"title"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL