Documentation
¶
Index ¶
- Constants
- Variables
- func AddAdapter(adapter *Adapter) (bool, error)
- func AddApplication(application *Application) (bool, error)
- func AddCert(cert *Cert) (bool, error)
- func AddEnforcer(enforcer *Enforcer) (bool, error)
- func AddForm(form *Form) (bool, error)
- func AddGroup(group *Group) (bool, error)
- func AddGroups(groups []*Group) (bool, error)
- func AddGroupsInBatch(groups []*Group) (bool, error)
- func AddInvitation(invitation *Invitation, lang string) (bool, error)
- func AddKey(key *Key) (bool, error)
- func AddLdap(ldap *Ldap) (bool, error)
- func AddModel(model *Model) (bool, error)
- func AddOrUpdateResource(resource *Resource) (bool, error)
- func AddOrganization(organization *Organization) (bool, error)
- func AddPermission(permission *Permission) (bool, error)
- func AddPermissions(permissions []*Permission) (bool, error)
- func AddPermissionsInBatch(permissions []*Permission) (bool, error)
- func AddPolicy(id string, ptype string, policy []string) (bool, error)
- func AddPrices(price1 float64, price2 float64) float64
- func AddProject(project *Project) (bool, error)
- func AddProvider(provider *Provider) (bool, error)
- func AddRadiusAccounting(ra *RadiusAccounting) error
- func AddRecord(record *Record) bool
- func AddResource(resource *Resource) (bool, error)
- func AddRole(role *Role) (bool, error)
- func AddRoles(roles []*Role) bool
- func AddRolesInBatch(roles []*Role) bool
- func AddRule(rule *Rule) (bool, error)
- func AddServer(server *Server) (bool, error)
- func AddSession(session *Session) (bool, error)
- func AddSite(site *Site) (bool, error)
- func AddSyncer(syncer *Syncer) (bool, error)
- func AddTicket(ticket *Ticket) (bool, error)
- func AddTicketMessage(id string, message *TicketMessage) (bool, error)
- func AddToVerificationRecord(user *User, provider *Provider, organization *Organization, ...) error
- func AddToken(token *Token) (bool, error)
- func AddUser(user *User, lang string) (bool, error)
- func AddUserKeys(user *User, isAdmin bool) (bool, error)
- func AddUserToOriginalDatabase(user *User) error
- func AddUsers(users []*User) (bool, error)
- func AddUsersInBatch(users []*User) (bool, error)
- func AddWalletLink(link *WalletLink) (bool, error)
- func AddWeb3Nonce(n *Web3Nonce) (bool, error)
- func AddWebhook(webhook *Webhook) (bool, error)
- func AdminAPIAdapterName() string
- func AdminAPIEnforcerName() string
- func AdminAPIModelName() string
- func AdminAppOrganization() string
- func AdminCertName() string
- func AdminPermissionName() string
- func AdminUserAdapterName() string
- func AdminUserEnforcerName() string
- func AdminUserModelName() string
- func AppAllowedForCapability(principal string, cap AppAdminCapability) bool
- func AppNameFromPrincipal(principal string) string
- func BatchEnforce(permission *Permission, requests [][]string, permissionIds ...string) ([]bool, error)
- func CheckAccountItemModifyRule(accountItem *AccountItem, isAdmin bool, lang string) (bool, string)
- func CheckApiPermission(userId string, organization string, path string, method string) (bool, error)
- func CheckCasLogin(application *Application, lang string, service string) error
- func CheckConsentRequired(userObj *User, application *Application, scopeStr string) (bool, error)
- func CheckEntryIp(clientIp string, user *User, application *Application, ...) error
- func CheckFaceId(user *User, faceId []float64, lang string) error
- func CheckInvitationDefaultCode(code string, defaultCode string, lang string) error
- func CheckIpWhitelist(ipWhitelistStr string, lang string) error
- func CheckLdapExist(ldap *Ldap) (bool, error)
- func CheckLdapUserPassword(user *User, password string, lang string, options ...bool) error
- func CheckLoginPermission(userId string, application *Application) (bool, error)
- func CheckPassword(user *User, password string, lang string, options ...bool) error
- func CheckPasswordComplexity(user *User, password string, lang string) string
- func CheckPasswordComplexityByOrg(organization *Organization, password string, lang string) string
- func CheckPasswordNotSameAsCurrent(user *User, newPassword string, organization *Organization) bool
- func CheckPermissionForUpdateUser(oldUser, newUser *User, isAdmin bool, allowDisplayNameEmpty bool, lang string) (bool, string)
- func CheckSigninCode(user *User, dest, code, lang string) error
- func CheckToEnableCaptcha(application *Application, organization, username string, clientIp string) (bool, error)
- func CheckUpdateUser(oldUser, user *User, lang string) string
- func CheckUserIsAdminRaw(owner, name string) bool
- func CheckUserPermission(requestUserId, userId string, strict bool, lang string) (bool, error)
- func CheckUserSignup(application *Application, organization *Organization, authForm *form.AuthForm, ...) string
- func CheckUsername(username string, lang string) string
- func CheckUsernameWithEmail(username string, lang string) string
- func CheckVerifyCodeWithLimit(user *User, dest, code, lang string) error
- func CleanupExpiredRevokedTokens() (int64, error)
- func CleanupTokens(tokenRetentionIntervalAfterExpiry int) error
- func ClearThroughputPerSecond()
- func ClearUserOAuthProperties(user *User, providerType string) (bool, error)
- func ContextWithOrgEngine(ctx context.Context, owner string) context.Context
- func ConvertCurrency(amount float64, fromCurrency, toCurrency string) float64
- func CopyUsersPerOrg(target *MigrationTarget, rows []map[string]any) (copied, dropped int64, orgs int, err error)
- func CreateTables()
- func DeleteAdapter(adapter *Adapter) (bool, error)
- func DeleteAllUserSessions(owner string, name string) (bool, error)
- func DeleteApplication(application *Application) (bool, error)
- func DeleteBeegoSession(sessionIds []string)
- func DeleteCert(cert *Cert) (bool, error)
- func DeleteEnforcer(enforcer *Enforcer) (bool, error)
- func DeleteFile(provider *Provider, objectKey string, lang string) error
- func DeleteForm(form *Form) (bool, error)
- func DeleteGroup(group *Group) (bool, error)
- func DeleteGroupForUser(user string, group string) (bool, error)
- func DeleteInvitation(invitation *Invitation) (bool, error)
- func DeleteKey(key *Key) (bool, error)
- func DeleteLdap(ldap *Ldap) (bool, error)
- func DeleteModel(model *Model) (bool, error)
- func DeleteOrganization(organization *Organization) (bool, error)
- func DeletePermission(permission *Permission) (bool, error)
- func DeleteProject(project *Project) (bool, error)
- func DeleteProvider(provider *Provider) (bool, error)
- func DeleteRadiusAccounting(ra *RadiusAccounting) error
- func DeleteResource(resource *Resource) (bool, error)
- func DeleteRole(role *Role) (bool, error)
- func DeleteRule(rule *Rule) (bool, error)
- func DeleteServer(server *Server) (bool, error)
- func DeleteSession(id, curSessionId string) (bool, error)
- func DeleteSessionId(id string, sessionId string) (bool, error)
- func DeleteSite(site *Site) (bool, error)
- func DeleteSyncer(syncer *Syncer) (bool, error)
- func DeleteTicket(ticket *Ticket) (bool, error)
- func DeleteToken(token *Token) (bool, error)
- func DeleteUser(user *User) (bool, error)
- func DeleteWalletLink(link *WalletLink) (bool, error)
- func DeleteWebhook(webhook *Webhook) (bool, error)
- func DeliverOTPViaNotify(ctx context.Context, in NotifySendInput) error
- func DialWithCert(SshUser string, CertId string, SshHost string, SshPort int) (*ssh.Client, error)
- func DialWithPassword(SshUser string, SshPassword string, SshHost string, SshPort int) (*ssh.Client, error)
- func DialWithPrivateKey(SshUser string, PrivateKey []byte, SshHost string, SshPort int) (*ssh.Client, error)
- func DisableVerificationCode(dest string) error
- func DisabledMultiFactorAuth(user *User) error
- func DownloadAndUpload(url string, fullFilePath string, lang string) (err error)
- func DropBogusEnforcerColumn(global *xorm.Engine) error
- func DumpToFile(filePath string) error
- func Enforce(permission *Permission, request []string, permissionIds ...string) (bool, error)
- func EnforceNotifyDeliveryGuard()
- func EnforceOTPProviderGuard()
- func EvictAppCache(owner, name string)
- func EvictAppCacheByClientId(clientId string)
- func EvictCertCache(name string)
- func EvictOrgCache(owner, name string)
- func EvictPermCache(userId string)
- func EvictUserCache(owner, name string)
- func ExpireTokenByAccessToken(accessToken string) (bool, *Application, *Token, error)
- func ExpireTokenByUser(owner, username string) (bool, error)
- func ExtendGroupWithUsers(group *Group) error
- func ExtendGroupsWithUsers(groups []*Group) error
- func ExtendUserWithRolesAndPermissions(user *User) (err error)
- func FromProviderToIdpInfo(ctx *context.Context, provider *Provider) (*idp.ProviderInfo, error)
- func GenerateCasToken(userId string, service string) (string, error)
- func GenerateId()
- func GenerateIdForNewUser(application *Application) (string, error)
- func GenerateSamlRequest(id, relayState, host, lang string) (auth string, method string, err error)
- func GetAccessTokenByUser(user *User, host string) (string, error)
- func GetAcmeClient(useProxy bool) (*lego.Client, error)
- func GetAdapterCount(owner, field, value string) (int64, error)
- func GetAllActions(userId string) ([]string, error)
- func GetAllObjects(userId string) ([]string, error)
- func GetAllRoles(userId string) ([]string, error)
- func GetApiKeyToken(application *Application, accessKey string, accessSecret string, scope string, ...) (*Token, *TokenError, error)
- func GetApplicationCount(owner, field, value string) (int64, error)
- func GetAuthorizationCodeToken(application *Application, clientSecret string, code string, verifier string, ...) (*Token, *TokenError, error)
- func GetBuiltInModel(modelText string) (authzmodel.Model, error)
- func GetCaptcha() (string, []byte, error)
- func GetCertCount(owner, field, value string) (int64, error)
- func GetClientCredentialsToken(application *Application, clientSecret string, scope string, host string) (*Token, *TokenError, error)
- func GetDashboard(owner string) (*map[string][]int64, error)
- func GetDeviceCodeToken(application *Application, deviceAuth *DeviceAuthCache, nonce string, ...) (*Token, *TokenError, error)
- func GetDomainExpireTime(domainName string) (string, error)
- func GetEnforcerCount(owner, field, value string) (int64, error)
- func GetExchangeRate(fromCurrency, toCurrency string) float64
- func GetExistUuids(owner string, uuids []string) ([]string, error)
- func GetExportFilePath() string
- func GetFailedSigninConfigByUser(user *User) (int, int, error)
- func GetFaviconUrl(htmlStr string) (string, error)
- func GetFilteredPolicies(id string, ptype string, fieldIndex int, fieldValues ...string) ([]*util.AuthzRule, error)
- func GetFilteredPoliciesMulti(id string, filters []Filter) ([]*util.AuthzRule, error)
- func GetFormCount(owner string, field, value string) (int64, error)
- func GetGlobalCertsCount(field, value string) (int64, error)
- func GetGlobalKeyCount(field, value string) (int64, error)
- func GetGlobalProviderCount(field, value string) (int64, error)
- func GetGlobalUserCount(field, value string) (int64, error)
- func GetGroupCount(owner, field, value string) (int64, error)
- func GetGroupUserCount(groupId string, field, value string) (int64, error)
- func GetGroupWithPrefix(group string) string
- func GetGroupWithoutPrefix(group string) string
- func GetGroupsHaveChildrenMap(groups []*Group) (map[string]*Group, error)
- func GetIdvProviderFromProvider(provider *Provider) idv.IdvProvider
- func GetImplicitToken(application *Application, username string, scope string, nonce string, ...) (*Token, *TokenError, error)
- func GetInitDataDiagnostics() map[string]interface{}
- func GetInvitationCount(owner, field, value string) (int64, error)
- func GetJwksBytes(applicationName string) (body []byte, etag string, err error)
- func GetJwtBearerToken(application *Application, assertion string, scope string, nonce string, ...) (*Token, *TokenError, error)
- func GetKeyCount(owner, field, value string) (int64, error)
- func GetModelCount(owner, field, value string) (int64, error)
- func GetOAuthToken(grantType string, clientId string, clientSecret string, code string, ...) (interface{}, error)
- func GetOnlineUserCount(owner string, isOnline int) (int64, error)
- func GetOrgEngineFromContext(ctx context.Context) *xorm.Engine
- func GetOrganizationApplicationCount(owner, organization, field, value string) (int64, error)
- func GetOrganizationCount(owner, name, field, value string) (int64, error)
- func GetPasswordToken(application *Application, username string, password string, scope string, ...) (*Token, *TokenError, error)
- func GetPermissionCount(owner, field, value string) (int64, error)
- func GetPolicies(id string) ([]*util.AuthzRule, error)
- func GetProjectCount(owner, field, value string) (int64, error)
- func GetProviderCount(owner, field, value string) (int64, error)
- func GetRecordCount(field, value string, filterRecord *Record) (int64, error)
- func GetResourceCount(owner, user, field, value string) (int64, error)
- func GetRevokedTokenCount(owner string, application string) (int64, error)
- func GetRoleCount(owner, field, value string) (int64, error)
- func GetRuleCount(owner, field, value string) (int64, error)
- func GetSamlRedirectAddress(owner string, application string, relayState string, samlRequest string, ...) string
- func GetSamlResponse(application *Application, user *User, samlRequest string, host string) (string, string, string, error)
- func GetServerCount(owner, field, value string) (int64, error)
- func GetSession(owner string, offset, limit int, field, value, sortField, sortOrder string) *xorm.Session
- func GetSessionCount(owner, field, value string) (int64, error)
- func GetSessionForUser(owner string, offset, limit int, field, value, sortField, sortOrder string) *xorm.Session
- func GetSiteCount(owner, field, value string) (int64, error)
- func GetSyncerCount(owner, organization, field, value string) (int64, error)
- func GetTicketCount(owner, field, value string) (int64, error)
- func GetTokenCount(owner, organization, field, value string) (int64, error)
- func GetTokenExchangeToken(application *Application, clientSecret string, subjectToken string, ...) (*Token, *TokenError, error)
- func GetTruncatedPath(provider *Provider, fullFilePath string, limit int) string
- func GetUploadFileUrl(provider *Provider, fullFilePath string, hasTimestamp bool) (string, string)
- func GetUserCount(owner, field, value string, groupName string) (int64, error)
- func GetUserField(user *User, field string) string
- func GetUserFieldStringValue(user *User, fieldName string) (bool, string, error)
- func GetUserOAuthAccessToken(user *User, providerType string) string
- func GetUserOAuthRefreshToken(user *User, providerType string) string
- func GetValidationBySaml(samlRequest string, host string) (string, string, error)
- func GetVerificationCount(owner, field, value string) (int64, error)
- func GetVerifyType(username string) (verificationCodeType string)
- func GetWebAuthnObject(host string) (*webauthn.WebAuthn, error)
- func GetWebhookCount(owner, organization, field, value string) (int64, error)
- func GetWechatMiniProgramToken(application *Application, code string, host string, username string, ...) (*Token, *TokenError, error)
- func GroupChangeTrigger(oldName, newName string) error
- func GroupPermissionsByModelAdapter(permissions []*Permission) map[string][]string
- func HasRoleDefinition(m authzmodel.Model) bool
- func HasUserByField(organizationName string, field string, value string) bool
- func InitAdapter()
- func InitCleanupTokens()
- func InitConfig()
- func InitDb()
- func InitDefaultStorageProvider()
- func InitFlag()
- func InitFromFile()
- func InitKMS()
- func InitLdapAutoSynchronizer()
- func InitRuleMap()
- func InitSiteMap()
- func InitUserManager()
- func InsertRows(eng *xorm.Engine, table string, rows []map[string]any) (copied, dropped int64, err error)
- func InterimUpdateRadiusAccounting(oldRa *RadiusAccounting, newRa *RadiusAccounting, stop bool) error
- func InvalidateJwksCache()
- func IsAllowSend(user *User, remoteAddr, recordType string, application *Application) error
- func IsAppUser(userId string) bool
- func IsGrantTypeValid(method string, grantTypes []string) bool
- func IsNeedPromptMfa(org *Organization, user *User) bool
- func IsOriginAllowed(origin string) (bool, error)
- func IsScopeValid(scope string, application *Application) bool
- func IsScopeValidAndExpand(scope string, application *Application) (string, bool)
- func IsServedHost(host string) bool
- func IsSessionDuplicated(id string, sessionId string) (bool, error)
- func IsSupportedWeb3Chain(chain wc.Chain) bool
- func IsTokenRevoked(tokenValue string) (bool, error)
- func IsTokenRevokedByHash(tokenHash string) (bool, error)
- func LinkUserAccount(user *User, field string, value string) (bool, error)
- func MfaRecover(user *User, recoveryCode string) error
- func MigratePhoneToE164(engine *xorm.Engine) (updated, skipped int, err error)
- func MoveUserToOrg(user *User, newOrg string) (bool, error)
- func NewSamlResponse(application *Application, user *User, host string, certificate string, ...) (*etree.Element, error)
- func NewSamlResponse11(application *Application, user *User, requestID string, host string) (*etree.Element, error)
- func NotifyDeliveryEnabled() bool
- func OrgIsolationEnabled() bool
- func ParseJwtTokenWithoutValidation(token string) (*jwt.Token, error)
- func ParseSamlResponse(samlResponse string, provider *Provider, host string) (*idp.UserInfo, error)
- func PromoteByEmailDomain(user *User) (bool, error)
- func ProvisionAuthzTables(global *xorm.Engine) error
- func PurgeExpiredWeb3Nonces() (int64, error)
- func RefreshToken(application *Application, grantType string, refreshToken string, scope string, ...) (interface{}, error)
- func RegisterDynamicClient(req *DynamicClientRegistrationRequest, organization string) (*DynamicClientRegistrationResponse, *DcrError, error)
- func RemovePolicy(id string, ptype string, policy []string) (bool, error)
- func RenewCert(cert *Cert) (bool, error)
- func ResetLdapPassword(user *User, oldPassword string, newPassword string, lang string) error
- func RevokeToken(tokenValue string, tokenType string, revokedBy string, clientId string, ...) error
- func RevokeTokenByHash(tokenHash string, tokenType string, revokedBy string, clientId string, ...) error
- func RevokeUserKeys(user *User, isAdmin bool) (bool, error)
- func RunSyncUsersJob()
- func RunSyncer(syncer *Syncer) error
- func SandboxOTPAllowed() bool
- func SanitizePolicyJsonArrays(engine *xorm.Engine) (updated int, err error)
- func SendNotification(provider *Provider, content string) error
- func SendSsoLogoutNotifications(user *User, sessionIds []string, tokens []*Token) error
- func SendVerificationCodeToEmail(organization *Organization, user *User, provider *Provider, remoteAddr string, ...) error
- func SendVerificationCodeToPhone(organization *Organization, user *User, provider *Provider, remoteAddr string, ...) error
- func SendWebhooks(record *Record) error
- func SetNotifyDeliverer(d notifyDeliverer) notifyDeliverer
- func SetPreferredMultiFactorAuth(user *User, mfaType string) error
- func SetUserField(user *User, field string, value string) (bool, error)
- func SetUserOAuthProperties(organization *Organization, user *User, providerType string, ...) (bool, error)
- func ShouldExportData() bool
- func SplitOriginList(s string) []string
- func StartMonitorSitesLoop()
- func StoreCasTokenForPgt(token *CasAuthenticationSuccess, service, userId string) string
- func StoreCasTokenForProxyTicket(token *CasAuthenticationSuccess, targetService, userId string) string
- func StringArrayToStruct[T any](stringArray [][]string) ([]*T, error)
- func SyncLdapGroups(owner string, ldapGroups []LdapGroup, ldapId string) (newGroups int, updatedGroups int, err error)
- func SyncLdapUsers(owner string, syncUsers []LdapUser, ldapId string) (existUsers []LdapUser, failedUsers []LdapUser, err error)
- func TestSyncer(syncer Syncer) error
- func TriggerWebhookForUser(action string, user *User)
- func UpdateAdapter(id string, adapter *Adapter) (bool, error)
- func UpdateApplication(id string, application *Application, isGlobalAdmin bool, lang string) (bool, error)
- func UpdateCert(id string, cert *Cert) (bool, error)
- func UpdateEnforcer(id string, enforcer *Enforcer) (bool, error)
- func UpdateForm(id string, form *Form) (bool, error)
- func UpdateGroup(id string, group *Group) (bool, error)
- func UpdateInvitation(id string, invitation *Invitation, lang string) (bool, error)
- func UpdateKey(id string, key *Key) (bool, error)
- func UpdateLdap(ldap *Ldap) (bool, error)
- func UpdateLdapSyncTime(ldapId string) error
- func UpdateModel(id string, modelObj *Model) (bool, error)
- func UpdateModelWithCheck(id string, modelObj *Model) error
- func UpdateOrganization(id string, organization *Organization, isGlobalAdmin bool) (bool, error)
- func UpdateOrganizationBalance(owner string, name string, balance float64, currency string, isOrgBalance bool, ...) error
- func UpdatePermission(id string, permission *Permission) (bool, error)
- func UpdatePolicy(id string, ptype string, oldPolicy []string, newPolicy []string) (bool, error)
- func UpdateProject(id string, project *Project) (bool, error)
- func UpdateProvider(id string, provider *Provider) (bool, error)
- func UpdateRadiusAccounting(id string, ra *RadiusAccounting) error
- func UpdateResource(id string, resource *Resource) (bool, error)
- func UpdateRole(id string, role *Role) (bool, error)
- func UpdateRule(id string, rule *Rule) (bool, error)
- func UpdateServer(id string, server *Server) (bool, error)
- func UpdateSession(id string, session *Session) (bool, error)
- func UpdateSite(id string, site *Site) (bool, error)
- func UpdateSiteNoRefresh(id string, site *Site) (bool, error)
- func UpdateSyncer(id string, syncer *Syncer, isGlobalAdmin bool, lang string) (bool, error)
- func UpdateTicket(id string, ticket *Ticket) (bool, error)
- func UpdateToken(id string, token *Token, isGlobalAdmin bool) (bool, error)
- func UpdateUser(id string, user *User, columns []string, isAdmin bool) (bool, error)
- func UpdateUserBalance(owner string, name string, balance float64, currency string, lang string) error
- func UpdateUserForAllFields(id string, user *User) (bool, error)
- func UpdateUserToOriginalDatabase(user *User) error
- func UpdateWebhook(id string, webhook *Webhook, isGlobalAdmin bool, lang string) (bool, error)
- func UploadFileSafe(provider *Provider, fullFilePath string, fileBuffer *bytes.Buffer, lang string) (string, string, error)
- func UploadGroups(owner string, path string) (bool, error)
- func UploadPermissions(owner string, path string) (bool, error)
- func UploadRoles(owner string, path string) (bool, error)
- func UploadUsers(owner string, path string, userObj *User, lang string) (bool, error)
- func ValidateKerberosToken(organization *Organization, spnegoTokenBase64 string) (string, error)
- func VerifyCaptcha(id string, digits string) bool
- func VerifyInvitation(id string) (attachInfo map[string]interface{}, err error)
- func VerifySsoLogoutSignature(clientSecret string, notification *SsoLogoutNotification) bool
- type AccountItem
- type ActiveDirectorySyncerProvider
- func (p *ActiveDirectorySyncerProvider) AddUser(user *OriginalUser) (bool, error)
- func (p *ActiveDirectorySyncerProvider) Close() error
- func (p *ActiveDirectorySyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
- func (p *ActiveDirectorySyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
- func (p *ActiveDirectorySyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
- func (p *ActiveDirectorySyncerProvider) InitAdapter() error
- func (p *ActiveDirectorySyncerProvider) TestConnection() error
- func (p *ActiveDirectorySyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
- type Adapter
- type Address
- type Affiliation
- type AppAdminCapability
- type Application
- func CheckOAuthLogin(clientId string, responseType string, redirectUri string, scope string, ...) (string, *Application, error)
- func FindApplicationByName(name, orgHint string) (*Application, error)
- func GetAllowedApplications(applications []*Application, userId string, lang string) ([]*Application, error)
- func GetApplication(id string) (*Application, error)
- func GetApplicationByClientId(clientId string) (*Application, error)
- func GetApplicationByOrganizationName(organization string) (*Application, error)
- func GetApplicationByUser(user *User) (*Application, error)
- func GetApplicationByUserId(userId string) (application *Application, err error)
- func GetApplications(owner string) ([]*Application, error)
- func GetDefaultApplication(id string) (*Application, error)
- func GetMaskedApplication(application *Application, userId string) *Application
- func GetMaskedApplications(applications []*Application, userId string) []*Application
- func GetOrganizationApplications(owner string, organization string) ([]*Application, error)
- func GetPaginationApplications(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Application, error)
- func GetPaginationOrganizationApplications(owner, organization string, offset, limit int, ...) ([]*Application, error)
- func NewAdminApp() *Application
- func ValidateClientAssertion(clientAssertion string, host string) (bool, *Application, error)
- func (application *Application) GetEmailProvider(method string) (*Provider, error)
- func (application *Application) GetId() string
- func (application *Application) GetProviderByCategory(category string) (*Provider, error)
- func (application *Application) GetProviderByCategoryAndRule(category string, method string, countryCode string) (*Provider, error)
- func (application *Application) GetProviderItem(providerName string) *ProviderItem
- func (application *Application) GetProviderItemByType(providerType string) *ProviderItem
- func (application *Application) GetSignupItemRule(itemName string) string
- func (application *Application) GetSmsProvider(method string, countryCode string) (*Provider, error)
- func (application *Application) GetStorageProvider() (*Provider, error)
- func (application *Application) HasPromptPage() bool
- func (application *Application) IsCodeSigninViaEmailEnabled() bool
- func (application *Application) IsCodeSigninViaSmsEnabled() bool
- func (application *Application) IsFaceIdEnabled() bool
- func (application *Application) IsLdapEnabled() bool
- func (application *Application) IsPasswordEnabled() bool
- func (application *Application) IsPasswordWithLdapEnabled() bool
- func (application *Application) IsRedirectUriValid(redirectUri string) bool
- func (application *Application) IsSignupItemRequired(itemName string) bool
- func (application *Application) IsSignupItemVisible(itemName string) bool
- type Attribute
- type AwsIamSyncerProvider
- func (p *AwsIamSyncerProvider) AddUser(user *OriginalUser) (bool, error)
- func (p *AwsIamSyncerProvider) Close() error
- func (p *AwsIamSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
- func (p *AwsIamSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
- func (p *AwsIamSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
- func (p *AwsIamSyncerProvider) InitAdapter() error
- func (p *AwsIamSyncerProvider) TestConnection() error
- func (p *AwsIamSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
- type AzureAdAccessTokenResp
- type AzureAdSyncerProvider
- func (p *AzureAdSyncerProvider) AddUser(user *OriginalUser) (bool, error)
- func (p *AzureAdSyncerProvider) Close() error
- func (p *AzureAdSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
- func (p *AzureAdSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
- func (p *AzureAdSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
- func (p *AzureAdSyncerProvider) InitAdapter() error
- func (p *AzureAdSyncerProvider) TestConnection() error
- func (p *AzureAdSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
- type AzureAdUser
- type AzureAdUserListResp
- type CasAnyAttribute
- type CasAttributes
- type CasAuthenticationFailure
- type CasAuthenticationSuccess
- type CasAuthenticationSuccessWrapper
- type CasNamedAttribute
- type CasProxies
- type CasProxyFailure
- type CasProxySuccess
- type CasServiceResponse
- type CasUserAttributes
- type Cert
- func GetCert(id string) (*Cert, error)
- func GetCertByDomain(domain string) (*Cert, error)
- func GetCerts(owner string) ([]*Cert, error)
- func GetDefaultCert() (*Cert, error)
- func GetGlobalCerts() ([]*Cert, error)
- func GetMaskedCert(cert *Cert) *Cert
- func GetMaskedCerts(certs []*Cert, err error) ([]*Cert, error)
- func GetPaginationCerts(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Cert, error)
- func GetPaginationGlobalCerts(offset, limit int, field, value, sortField, sortOrder string) ([]*Cert, error)
- type Claims
- type ClaimsShort
- type ClaimsStandard
- type ClaimsWithoutThirdIdp
- type Code
- type ConsentRecord
- type Credential
- type DashboardDateItem
- type DashboardMapItem
- type DatabaseSyncerProvider
- func (p *DatabaseSyncerProvider) AddUser(user *OriginalUser) (bool, error)
- func (p *DatabaseSyncerProvider) Close() error
- func (p *DatabaseSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
- func (p *DatabaseSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
- func (p *DatabaseSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
- func (p *DatabaseSyncerProvider) InitAdapter() error
- func (p *DatabaseSyncerProvider) TestConnection() error
- func (p *DatabaseSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
- type DcrError
- type DeviceAuthCache
- type DeviceAuthResponse
- type DingtalkAccessTokenResp
- type DingtalkDepartment
- type DingtalkDeptDetailResp
- type DingtalkDeptListResp
- type DingtalkResult
- type DingtalkSyncerProvider
- func (p *DingtalkSyncerProvider) AddUser(user *OriginalUser) (bool, error)
- func (p *DingtalkSyncerProvider) Close() error
- func (p *DingtalkSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
- func (p *DingtalkSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
- func (p *DingtalkSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
- func (p *DingtalkSyncerProvider) InitAdapter() error
- func (p *DingtalkSyncerProvider) TestConnection() error
- func (p *DingtalkSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
- type DingtalkUser
- type DingtalkUserListResp
- type DomainPromotion
- type DynamicClientRegistrationRequest
- type DynamicClientRegistrationResponse
- type Enforcer
- type Expression
- type FaceId
- type Filter
- type Form
- func GetForm(id string) (*Form, error)
- func GetForms(owner string) ([]*Form, error)
- func GetGlobalForms() ([]*Form, error)
- func GetMaskedForm(form *Form, isMaskEnabled bool) *Form
- func GetMaskedForms(forms []*Form, isMaskEnabled bool) []*Form
- func GetPaginationForms(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Form, error)
- type FormItem
- type GaugeVecInfo
- type Group
- func ConvertToTreeData(groups []*Group, parentId string) []*Group
- func GetGlobalGroups() ([]*Group, error)
- func GetGroup(id string) (*Group, error)
- func GetGroups(owner string) ([]*Group, error)
- func GetPaginationGroups(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Group, error)
- type GroupNode
- type Header
- type HistogramVecInfo
- type HttpProvider
- type IdpEntityDescriptor
- type IdpSSODescriptor
- type InitData
- type IntrospectionResponse
- type Invitation
- func CheckInvitationCode(application *Application, organization *Organization, authForm *form.AuthForm, ...) (*Invitation, string)
- func GetInvitation(id string) (*Invitation, error)
- func GetInvitationByCode(code string, organizationName string, lang string) (*Invitation, string)
- func GetInvitations(owner string) ([]*Invitation, error)
- func GetMaskedInvitation(invitation *Invitation) *Invitation
- func GetPaginationInvitations(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Invitation, error)
- func (invitation *Invitation) GetId() string
- func (invitation *Invitation) GetInvitationLink(host string, application string) string
- func (invitation *Invitation) IsInvitationCodeValid(application *Application, invitationCode string, username string, email string, ...) (bool, string)
- func (invitation *Invitation) SimpleCheckInvitationCode(invitationCode string, lang string) (bool, string)
- type JsonWebKeySet
- type JwtItem
- type Key
- func GetGlobalKeys() ([]*Key, error)
- func GetKey(id string) (*Key, error)
- func GetKeyByAccessKey(accessKey string) (*Key, error)
- func GetKeyBySecretKey(secretKey string) (*Key, error)
- func GetKeys(owner string) ([]*Key, error)
- func GetMaskedKey(key *Key, isMaskEnabled bool) *Key
- func GetMaskedKeys(keys []*Key, isMaskEnabled bool, err error) ([]*Key, error)
- func GetPaginationGlobalKeys(offset, limit int, field, value, sortField, sortOrder string) ([]*Key, error)
- func GetPaginationKeys(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Key, error)
- func ResolveAnyKey(token string) (*Key, bool, error)
- type KeyDescriptor
- type KeyInfo
- type KeycloakSyncerProvider
- type LarkAccessTokenResp
- type LarkAvatar
- type LarkDeptListResp
- type LarkStatus
- type LarkSyncerProvider
- func (p *LarkSyncerProvider) AddUser(user *OriginalUser) (bool, error)
- func (p *LarkSyncerProvider) Close() error
- func (p *LarkSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
- func (p *LarkSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
- func (p *LarkSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
- func (p *LarkSyncerProvider) InitAdapter() error
- func (p *LarkSyncerProvider) TestConnection() error
- func (p *LarkSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
- type LarkUser
- type LarkUserListResp
- type Ldap
- type LdapAutoSynchronizer
- type LdapConn
- type LdapGroup
- type LdapUser
- type Link
- type MLDSA65WebKey
- type ManagedAccount
- type MfaAccount
- type MfaInterface
- type MfaItem
- type MfaProps
- type MigrationTarget
- type Model
- type NameIDFormat
- type NodeItem
- type NotifySendInput
- type OIDCAddress
- type OauthProtectedResourceMetadata
- type OidcDiscovery
- type OktaSyncerProvider
- func (p *OktaSyncerProvider) AddUser(user *OriginalUser) (bool, error)
- func (p *OktaSyncerProvider) Close() error
- func (p *OktaSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
- func (p *OktaSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
- func (p *OktaSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
- func (p *OktaSyncerProvider) InitAdapter() error
- func (p *OktaSyncerProvider) TestConnection() error
- func (p *OktaSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
- type OktaUser
- type OrgDBManager
- func (m *OrgDBManager) DeleteOrg(owner string) error
- func (m *OrgDBManager) Encrypted() bool
- func (m *OrgDBManager) GetEngine(owner string) (*xorm.Engine, error)
- func (m *OrgDBManager) ListOrgs() ([]string, error)
- func (m *OrgDBManager) ProvisionOrg(owner string) error
- func (m *OrgDBManager) ReleasePools()
- func (m *OrgDBManager) Rewrap(oldMaster, newMaster []byte) error
- type Organization
- func CreatePersonalOrganization(username, displayName string) (*Organization, error)
- func GetMaskedOrganization(organization *Organization, errs ...error) (*Organization, error)
- func GetMaskedOrganizations(organizations []*Organization, errs ...error) ([]*Organization, error)
- func GetOrganization(id string) (*Organization, error)
- func GetOrganizationByUser(user *User) (*Organization, error)
- func GetOrganizations(owner string, name ...string) ([]*Organization, error)
- func GetOrganizationsByFields(owner string, fields ...string) ([]*Organization, error)
- func GetPaginationOrganizations(owner string, name string, offset, limit int, ...) ([]*Organization, error)
- func NewAdminOrg() *Organization
- func NewOrg(name string) *Organization
- type OriginalGroup
- type OriginalUser
- type Ormer
- type PK
- type Permission
- func GetMaskedPermissions(permissions []*Permission) []*Permission
- func GetPaginationPermissions(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Permission, error)
- func GetPermission(id string) (*Permission, error)
- func GetPermissions(owner string) ([]*Permission, error)
- func GetPermissionsByModel(owner string, model string) ([]*Permission, error)
- func GetPermissionsByResource(resourceId string) ([]*Permission, error)
- func GetPermissionsByRole(roleId string) ([]*Permission, error)
- func GetPermissionsBySubmitter(owner string, submitter string) ([]*Permission, error)
- type ProductInfo
- type Project
- type PrometheusInfo
- type Provider
- func GetCaptchaProviderByApplication(applicationId, isCurrentProvider, lang string) (*Provider, error)
- func GetCaptchaProviderByOwnerName(applicationId, lang string) (*Provider, error)
- func GetFaceIdProviderByApplication(applicationId, isCurrentProvider, lang string) (*Provider, error)
- func GetFaceIdProviderByOwnerName(applicationId, lang string) (*Provider, error)
- func GetGlobalProviders() ([]*Provider, error)
- func GetIdvProviderByApplication(applicationId, isCurrentProvider, lang string) (*Provider, error)
- func GetIdvProviderByOwnerName(applicationId, lang string) (*Provider, error)
- func GetMaskedProvider(provider *Provider, isMaskEnabled bool) *Provider
- func GetMaskedProviders(providers []*Provider, isMaskEnabled bool) []*Provider
- func GetPaginationGlobalProviders(offset, limit int, field, value, sortField, sortOrder string) ([]*Provider, error)
- func GetPaginationProviders(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Provider, error)
- func GetProvider(id string) (*Provider, error)
- func GetProviders(owner string) ([]*Provider, error)
- func GetProvidersByCategory(owner string, category string) ([]*Provider, error)
- func GetWechatMiniProgramProvider(application *Application) *Provider
- type ProviderItem
- type PushMfa
- type RadiusAccounting
- type RadiusMfa
- type Record
- func CopyRecord(record *Record) *Record
- func GetPaginationRecords(offset, limit int, field, value, sortField, sortOrder string, ...) ([]*Record, error)
- func GetRecords() ([]*Record, error)
- func GetRecordsByField(record *Record) ([]*Record, error)
- func NewRecord(ctx *context.Context) (*Record, error)
- type Resource
- func GetDirectResources(owner string, user string, provider *Provider, prefix string, lang string) ([]*Resource, error)
- func GetPaginationResources(owner, user string, offset, limit int, ...) ([]*Resource, error)
- func GetResource(id string) (*Resource, error)
- func GetResources(owner string, user string) ([]*Resource, error)
- type Response
- type RevokedToken
- type Role
- func GetAncestorRoles(roleIds ...string) ([]*Role, error)
- func GetMaskedRoles(roles []*Role) []*Role
- func GetPaginationRoles(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Role, error)
- func GetRole(id string) (*Role, error)
- func GetRoles(owner string) ([]*Role, error)
- type Rule
- type SCIMAddress
- type SCIMEmail
- type SCIMListResponse
- type SCIMName
- type SCIMPhoneNumber
- type SCIMSyncerProvider
- func (p *SCIMSyncerProvider) AddUser(user *OriginalUser) (bool, error)
- func (p *SCIMSyncerProvider) Close() error
- func (p *SCIMSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
- func (p *SCIMSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
- func (p *SCIMSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
- func (p *SCIMSyncerProvider) InitAdapter() error
- func (p *SCIMSyncerProvider) TestConnection() error
- func (p *SCIMSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
- type SCIMUser
- type SafeAdapter
- type Saml11AssertionArtifact
- type Saml11Request
- type SamlItem
- type ScopeDescription
- type ScopeItem
- type Server
- type Session
- func GetPaginationSessions(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Session, error)
- func GetSessions(owner string) ([]*Session, error)
- func GetSingleSession(id string) (*Session, error)
- func GetUserAppSessions(owner string, name string, application string) ([]*Session, error)
- func GetUserSessions(owner string, name string) ([]*Session, error)
- type SigninItem
- type SigninMethod
- type SignupItem
- type SingleSignOnService
- type Site
- func GetGlobalSites() ([]*Site, error)
- func GetMaskedSite(site *Site, node string) *Site
- func GetMaskedSites(sites []*Site, node string) []*Site
- func GetPaginationSites(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Site, error)
- func GetSite(id string) (*Site, error)
- func GetSiteByDomain(domain string) *Site
- func GetSites(owner string) ([]*Site, error)
- type SmsMfa
- type SsoLogoutNotification
- type Syncer
- func GetMaskedSyncer(syncer *Syncer, errs ...error) (*Syncer, error)
- func GetMaskedSyncers(syncers []*Syncer, errs ...error) ([]*Syncer, error)
- func GetOrganizationSyncers(owner, organization string) ([]*Syncer, error)
- func GetPaginationSyncers(owner, organization string, offset, limit int, ...) ([]*Syncer, error)
- func GetSyncer(id string) (*Syncer, error)
- func GetSyncers(owner string) ([]*Syncer, error)
- type SyncerProvider
- type TableColumn
- type ThemeData
- type Ticket
- type TicketMessage
- type Token
- func GetPaginationTokens(owner, organization string, offset, limit int, ...) ([]*Token, error)
- func GetToken(id string) (*Token, error)
- func GetTokenByAccessToken(accessToken string) (*Token, error)
- func GetTokenByRefreshToken(refreshToken string) (*Token, error)
- func GetTokenByTokenValue(tokenValue, tokenTypeHint string) (*Token, error)
- func GetTokenByUser(application *Application, user *User, scope string, nonce string, host string) (*Token, error)
- func GetTokens(owner string, organization string) ([]*Token, error)
- func GetTokensByUser(owner, username string) ([]*Token, error)
- func GetUserTokenForAudience(application *Application, user *User, audience string, scope string, ...) (*Token, error)
- type TokenError
- type TokenWrapper
- type Tool
- type TotpMfa
- type User
- func CheckUserPassword(organization string, username string, password string, lang string, ...) (*User, error)
- func ExtendManagedAccountsWithUser(user *User) (*User, error)
- func GetFilteredUser(user *User, isAdmin bool, isAdminOrSelf bool, accountItems []*AccountItem) (*User, error)
- func GetGlobalUsers() ([]*User, error)
- func GetGlobalUsersWithFilter(cond builder.Cond) ([]*User, error)
- func GetGroupUsers(groupId string) ([]*User, error)
- func GetGroupUsersWithoutError(groupId string) []*User
- func GetMaskedUser(user *User, isAdminOrSelf bool, errs ...error) (*User, error)
- func GetMaskedUsers(users []*User, errs ...error) ([]*User, error)
- func GetPaginationGlobalUsers(offset, limit int, field, value, sortField, sortOrder string) ([]*User, error)
- func GetPaginationGroupUsers(groupId string, offset, limit int, field, value, sortField, sortOrder string) ([]*User, error)
- func GetPaginationUsers(owner string, offset, limit int, field, value, sortField, sortOrder string, ...) ([]*User, error)
- func GetSortedUsers(owner string, sorter string, limit int) ([]*User, error)
- func GetUser(id string) (*User, error)
- func GetUserByAccessKey(accessKey string) (*User, error)
- func GetUserByEmail(owner string, email string) (*User, error)
- func GetUserByEmailOnly(email string) (*User, error)
- func GetUserByField(organizationName string, field string, value string) (*User, error)
- func GetUserByFieldCrossOrg(field string, value string) (*User, error)
- func GetUserByFields(organization string, field string) (*User, error)
- func GetUserByInvitationCode(owner string, invitationCode string) (*User, error)
- func GetUserByKerberosName(organizationName string, kerberosUsername string) (*User, error)
- func GetUserByPhone(owner string, phone string) (*User, error)
- func GetUserByPhoneOnly(phone string) (*User, error)
- func GetUserByPhoneWithCountry(owner string, phone string, countryCode string) (*User, error)
- func GetUserByUserId(owner string, userId string) (*User, error)
- func GetUserByUserIdOnly(userId string) (*User, error)
- func GetUserByWebauthID(webauthId string) (*User, error)
- func GetUserNoCheck(id string) (*User, error)
- func GetUsers(owner string) ([]*User, error)
- func GetUsersByFieldCrossOrg(field string, value string) ([]*User, error)
- func GetUsersByTagWithFilter(owner string, tag string, cond builder.Cond) ([]*User, error)
- func GetUsersWithFilter(owner string, cond builder.Cond) ([]*User, error)
- func NewAdminUser() *User
- func VerifyWalletLogin(in WalletLoginInput) (*User, error)
- func (user *User) AddCredentials(credential webauthn.Credential, isGlobalAdmin bool) (bool, error)
- func (user *User) CheckUserFace(faceIdImage []string, provider *Provider) (bool, error)
- func (user *User) CredentialExcludeList() []protocol.CredentialDescriptor
- func (user *User) DeleteCredentials(credentialIdBase64 string) (bool, error)
- func (user *User) GetCountryCode(countryCode string) string
- func (user *User) GetFriendlyName() string
- func (user *User) GetId() string
- func (user *User) GetMfaProps(mfaType string, masked bool) *MfaProps
- func (user *User) GetPreferredMfaProps(masked bool) *MfaProps
- func (user *User) GetUserFullGroupPath() ([]string, error)
- func (user *User) IsAdminUser() bool
- func (user *User) IsApplicationAdmin(application *Application) bool
- func (user *User) IsGlobalAdmin() bool
- func (user *User) IsMfaEnabled() bool
- func (user *User) UpdateUserHash() error
- func (user *User) UpdateUserPassword(organization *Organization)
- func (user *User) WebAuthnCredentials() []webauthn.Credential
- func (user *User) WebAuthnDisplayName() string
- func (user *User) WebAuthnID() []byte
- func (user *User) WebAuthnIcon() string
- func (user *User) WebAuthnName() string
- type UserGroupEnforcer
- func (e *UserGroupEnforcer) AddGroupForUser(user string, group string) (bool, error)
- func (e *UserGroupEnforcer) AddGroupsForUser(user string, groups []string) (bool, error)
- func (e *UserGroupEnforcer) DeleteGroupForUser(user string, group string) (bool, error)
- func (e *UserGroupEnforcer) DeleteGroupsForUser(user string) (bool, error)
- func (e *UserGroupEnforcer) GetAllUsersByGroup(group string) ([]string, error)
- func (e *UserGroupEnforcer) GetGroupsForUser(user string) ([]string, error)
- func (e *UserGroupEnforcer) GetUserNamesByGroupName(groupName string) ([]string, error)
- func (e *UserGroupEnforcer) UpdateGroupsForUser(user string, groups []string) (bool, error)
- type UserShort
- type UserStandard
- type UserWithoutThirdIdp
- type Userinfo
- type ValidatorFunc
- type VerificationRecord
- func GetPaginationVerifications(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*VerificationRecord, error)
- func GetUserVerifications(owner, user string) ([]*VerificationRecord, error)
- func GetVerification(id string) (*VerificationRecord, error)
- func GetVerifications(owner string) ([]*VerificationRecord, error)
- type VerifyResult
- type ViaSSHDialer
- func (v *ViaSSHDialer) Dial(network, address string) (net.Conn, error)
- func (v *ViaSSHDialer) DialContext(ctx context.Context, network string, addr string) (net.Conn, error)
- func (v *ViaSSHDialer) DialTimeout(network, address string, timeout time.Duration) (net.Conn, error)
- func (v *ViaSSHDialer) MysqlDial(ctx context.Context, addr string) (net.Conn, error)
- func (v *ViaSSHDialer) Open(s string) (_ driver.Conn, err error)
- type WalletLink
- type WalletLoginInput
- type Web3Nonce
- type WebFinger
- type WebFingerLink
- type Webhook
- type WecomAccessTokenResp
- type WecomDeptListResp
- type WecomSyncerProvider
- func (p *WecomSyncerProvider) AddUser(user *OriginalUser) (bool, error)
- func (p *WecomSyncerProvider) Close() error
- func (p *WecomSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
- func (p *WecomSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
- func (p *WecomSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
- func (p *WecomSyncerProvider) InitAdapter() error
- func (p *WecomSyncerProvider) TestConnection() error
- func (p *WecomSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
- type WecomUser
- type WecomUserListResp
- type X509Certificate
- type X509Data
- type X509Key
Constants ¶
const ( DefaultFailedSigninLimit = 5 DefaultFailedSigninFrozenTime = 15 )
const ( EmailType = "email" SmsType = "sms" TotpType = "app" RadiusType = "radius" PushType = "push" )
const ( MfaSessionUserId = "MfaSessionUserId" NextMfa = "NextMfa" RequiredMfa = "RequiredMfa" )
const ( ProviderTypeGoogleCloudStorage = "Google Cloud Storage" ProviderTypeTencentCloudCOS = "Tencent Cloud COS" ProviderTypeAzureBlob = "Azure Blob" ProviderTypeLocalFileSystem = "Local File System" ProviderTypeMinIO = "MinIO" )
const ( InvalidRequest = "invalid_request" InvalidClient = "invalid_client" InvalidGrant = "invalid_grant" UnsupportedGrantType = "unsupported_grant_type" InvalidScope = "invalid_scope" EndpointError = "endpoint_error" )
const ( // DeviceCodeExpirySeconds bounds how long a device_code / user_code pair is // valid (RFC 8628 `expires_in`). It is the SINGLE source of truth for the // device grant's lifetime — the authorization handler, the token poll, and // the discovery response all read it, so they can never drift. 15 minutes // gives a human time to open the verification URL, authenticate via SSO, // and approve on a second device. DeviceCodeExpirySeconds = 900 // DeviceCodePollInterval is the minimum seconds a client must wait between // token-endpoint polls (RFC 8628 `interval`). DeviceCodePollInterval = 5 )
const ( UserPropertiesWechatUnionId = "wechatUnionId" UserPropertiesWechatOpenId = "wechatOpenId" )
const ( VerifyTypePhone = "phone" VerifyTypeEmail = "email" )
const ( OidcPathAuthorize = "/v1/iam/oauth/authorize" OidcPathToken = "/v1/iam/oauth/token" OidcPathUserinfo = "/v1/iam/oauth/userinfo" OidcPathDevice = "/v1/iam/oauth/device" OidcPathRegister = "/v1/iam/oauth/register" OidcPathIntrospect = "/v1/iam/oauth/introspect" OidcPathRevoke = "/v1/iam/oauth/revoke" OidcPathEndSession = "/v1/iam/oauth/logout" OidcPathWellKnownBase = "/v1/iam/.well-known" )
Canonical public OIDC paths. The IAM service publishes its discovery doc using ONLY these — external consumers (IdPs, SDKs, OIDC libraries) see exactly one shape per endpoint. /v1/iam/* is the law.
const (
MfaTotpPeriodInSeconds = 30
)
const MigrationUserTable = "user"
MigrationUserTable is the snake-cased name of the per-org User table (tableNamePrefix is "" in production). Rows in this table are routed to per-org engines; every other table goes to the global engine — exactly the runtime's orgEngine routing (orgEngine is called only from user.go).
const ( // NotifyOTPEvent is the event-catalog identifier notifyd routes on. // Templates registered against this event for a tenant are picked up // automatically when SendRequest.Event is set and TemplateID is // omitted (notifyd resolves channel + template from the catalog). NotifyOTPEvent = "iam.otp_sent" )
const (
VerificationSuccess = iota
)
Variables ¶
var ( // CapUserPasswordAdmin gates resetting/overwriting ANOTHER user's // password without the old password or an emailed/SMS verification code // (the set-password endpoint). Allowlist: IAM_PASSWORD_ADMIN_APPS. CapUserPasswordAdmin = AppAdminCapability{Name: "password", EnvVar: "IAM_PASSWORD_ADMIN_APPS"} // CapUserAdmin gates sensitive cross-user account mutations: // update-user (password, is_admin, owner -> admin org == global admin, // email, phone, type, balance, access_key, ...), add-user and // delete-user. Allowlist: IAM_USER_ADMIN_APPS. CapUserAdmin = AppAdminCapability{Name: "user", EnvVar: "IAM_USER_ADMIN_APPS"} // CapAppAdmin gates application (OAuth client) mutations: // add/update/delete-application. This is the escalation vector that would // otherwise let an arbitrary app rotate an allowlisted app's clientSecret // and then authenticate as it, so it is gated with the same mechanism. // Allowlist: IAM_APP_ADMIN_APPS. CapAppAdmin = AppAdminCapability{Name: "application", EnvVar: "IAM_APP_ADMIN_APPS"} // CapKeyMint gates minting/revoking ANY user's hk- key on their behalf // (the per-tenant isolation layer is enforced by the trusted caller, e.g. // the console). This pre-existing gate (controllers/user.go // resolveTargetUserForKeys) is folded into the one helper so all // app-capability checks share a single mechanism. Allowlist: // IAM_KEY_MINT_ALLOWED_APPS. CapKeyMint = AppAdminCapability{Name: "key-mint", EnvVar: "IAM_KEY_MINT_ALLOWED_APPS"} // CapCertAdmin gates certificate mutations: add/update/delete-cert. This is // the HIGHEST-severity surface — a Cert holds the JWT *signing* private key, // so an app that could add/rotate/replace a cert could forge a token for any // user in any org (full account takeover, org-wide). Allowlist: // IAM_CERT_ADMIN_APPS. Deliberately EMPTY/unset in every environment // (fail-secure deny-all): NO confidential client should ever touch signing // material via an app credential — cert rotation is a real-global-admin USER // (human, User.IsGlobalAdmin()) operation, and that human path is unaffected // by this gate. CapCertAdmin = AppAdminCapability{Name: "cert", EnvVar: "IAM_CERT_ADMIN_APPS"} // CapKeyAdmin gates Key-object mutations: add/update/delete-key. (Distinct // from CapKeyMint, which gates per-user hk- Cloud API key minting.) Allowlist: // IAM_KEY_ADMIN_APPS (empty/unset = deny all). CapKeyAdmin = AppAdminCapability{Name: "key", EnvVar: "IAM_KEY_ADMIN_APPS"} // CapOrgAdmin gates organization mutations: add/update/delete-organization. // Moving a user into the admin org == granting global admin, and deleting an // org is destructive, so org mutation is gated. UNLIKE the other new caps // this one is NOT empty by default: the brand consoles legitimately create // orgs via their app credential during onboarding, so the deploy allowlists // them (IAM_ORG_ADMIN_APPS=hanzo-console,lux-console,zoo-console,pars-console). // Note: project mutation (add/update/delete-project) is a SEPARATE, // un-gated surface — console onboarding's project creation is unaffected. CapOrgAdmin = AppAdminCapability{Name: "organization", EnvVar: "IAM_ORG_ADMIN_APPS"} // CapProviderAdmin gates provider mutations: add/update/delete-provider. // Providers hold OAuth/SMS/email/Web3 client secrets; a rogue provider can // redirect or intercept auth. Seeding at boot uses the in-process object // layer (object/init.go, init_data.json), NOT this HTTP controller, so the // deny-all default does not affect bootstrap. Allowlist: IAM_PROVIDER_ADMIN_APPS // (empty/unset = deny all; the optional init-providers reconcile Job, if used, // must be explicitly allowlisted here). CapProviderAdmin = AppAdminCapability{Name: "provider", EnvVar: "IAM_PROVIDER_ADMIN_APPS"} // CapSyncerAdmin gates syncer mutations: add/update/delete-syncer. A syncer // has DB credentials and can read/write the user store on a schedule. // Allowlist: IAM_SYNCER_ADMIN_APPS (empty/unset = deny all). CapSyncerAdmin = AppAdminCapability{Name: "syncer", EnvVar: "IAM_SYNCER_ADMIN_APPS"} // CapWebhookAdmin gates webhook mutations: add/update/delete-webhook. A // webhook can exfiltrate auth events to an attacker-controlled endpoint. // Allowlist: IAM_WEBHOOK_ADMIN_APPS (empty/unset = deny all). CapWebhookAdmin = AppAdminCapability{Name: "webhook", EnvVar: "IAM_WEBHOOK_ADMIN_APPS"} // CapTokenAdmin gates OAuth Token-object mutations: add/update/delete-token. // Forging a Token row mints a bearer token out of band. Allowlist: // IAM_TOKEN_ADMIN_APPS (empty/unset = deny all). (Normal token issuance via // the OAuth grant endpoints is unaffected — this gates only the admin CRUD.) CapTokenAdmin = AppAdminCapability{Name: "token", EnvVar: "IAM_TOKEN_ADMIN_APPS"} )
var ( ApiThroughput = metric.NewGaugeVec(metric.GaugeOpts{ Name: "iam_api_throughput", Help: "The throughput of each api access", }, []string{"path", "method"}) ApiLatency = metric.NewHistogramVec(metric.HistogramOpts{ Name: "iam_api_latency", Help: "API processing latency in milliseconds", }, []string{"path", "method"}) CpuUsage = metric.NewGaugeVec(metric.GaugeOpts{ Name: "iam_cpu_usage", Help: "IAM cpu usage", }, []string{"cpuNum"}) MemoryUsage = metric.NewGaugeVec(metric.GaugeOpts{ Name: "iam_memory_usage", Help: "IAM memory usage in Byte", }, []string{"type"}) TotalThroughput = metric.NewGauge(metric.GaugeOpts{ Name: "iam_total_throughput", Help: "The total throughput of iam", }) )
var ( DefaultApplication = "hanzo-app" DefaultOrganization = "hanzo" )
var DeviceAuthMap = sync.Map{}
var MigrationAuthzTables = []string{
"authz_rule",
"authz_user_rule",
"authz_api_rule",
"permission_rule",
}
MigrationAuthzTables enumerates the runtime-allocated authz adapter tables IAM creates OUTSIDE object/ormer.go's Sync2 registry (each is a flat (ptype, v0..v5) policy table). They are GLOBAL (authz is not per-org). The names match init.go's adapter inserts and permission_enforcer.go's `permission_rule` literal. authz_rule is the base adapter table created by the default `xorm.NewEngine`-backed authz.Enforcer; including it keeps the destination a strict superset so a source row in any of these tables is never silently dropped for "no destination table".
var (
ResetLinkReg *regexp.Regexp
)
var (
// SigningMethodMLDSA65 is the JWT signing method for ML-DSA-65.
SigningMethodMLDSA65 *signingMethodMLDSA65
)
var (
SiteMap = map[string]*Site{}
)
var UserAuthzEnforcerId = conf.AdminOrg + "/user-enforcer-" + conf.AdminApp
UserAuthzEnforcerId is the composite ID for the user authz enforcer in the admin org. Derived from conf.AdminOrg / conf.AdminApp at package init; immutable thereafter.
Functions ¶
func AddAdapter ¶
func AddApplication ¶
func AddApplication(application *Application) (bool, error)
func AddEnforcer ¶
func AddGroupsInBatch ¶
func AddInvitation ¶
func AddInvitation(invitation *Invitation, lang string) (bool, error)
func AddOrUpdateResource ¶
func AddOrganization ¶
func AddOrganization(organization *Organization) (bool, error)
func AddPermission ¶
func AddPermission(permission *Permission) (bool, error)
func AddPermissions ¶
func AddPermissions(permissions []*Permission) (bool, error)
func AddPermissionsInBatch ¶
func AddPermissionsInBatch(permissions []*Permission) (bool, error)
func AddProject ¶
func AddProvider ¶
func AddRadiusAccounting ¶
func AddRadiusAccounting(ra *RadiusAccounting) error
func AddResource ¶
func AddRolesInBatch ¶
func AddSession ¶
func AddTicketMessage ¶
func AddTicketMessage(id string, message *TicketMessage) (bool, error)
func AddToVerificationRecord ¶
func AddToVerificationRecord(user *User, provider *Provider, organization *Organization, remoteAddr, recordType, dest, code string) error
func AddUsersInBatch ¶
func AddWalletLink ¶ added in v1.22.1
func AddWalletLink(link *WalletLink) (bool, error)
func AddWeb3Nonce ¶ added in v1.22.1
func AddWebhook ¶
func AdminAPIAdapterName ¶ added in v1.14.21
func AdminAPIAdapterName() string
func AdminAPIEnforcerName ¶ added in v1.14.21
func AdminAPIEnforcerName() string
func AdminAPIModelName ¶ added in v1.14.21
func AdminAPIModelName() string
func AdminAppOrganization ¶ added in v1.14.21
func AdminAppOrganization() string
AdminAppOrganization is the value to drop into Application.Organization / User.SignupApplication when wiring records to the admin app.
func AdminCertName ¶ added in v1.14.21
func AdminCertName() string
AdminCertName is the name of the JWT signing cert for the admin app.
func AdminPermissionName ¶ added in v1.14.21
func AdminPermissionName() string
AdminPermissionName is the name of the admin permission row.
func AdminUserAdapterName ¶ added in v1.14.21
func AdminUserAdapterName() string
AdminUserAdapterName / AdminAPIAdapterName are authz adapter names.
func AdminUserEnforcerName ¶ added in v1.14.21
func AdminUserEnforcerName() string
AdminUserEnforcerName / AdminAPIEnforcerName are authz enforcer names.
func AdminUserModelName ¶ added in v1.14.21
func AdminUserModelName() string
AdminUserModelName / AdminAPIModelName are authz model names.
func AppAllowedForCapability ¶ added in v1.25.4
func AppAllowedForCapability(principal string, cap AppAdminCapability) bool
AppAllowedForCapability reports whether the confidential-client principal ("app/<name>") is explicitly allowlisted for capability cap.
Fail-secure: an unset or empty allowlist denies every app. A principal that is not in "app/<name>" form returns false — this gate concerns app credentials only; human principals are authorized elsewhere and must NEVER be granted (or denied) by this function. The allowlist holds application NAMES, which equal the registered clientId for the synthetic app-user (see getUsernameByClientIdSecret), matching the IAM_BY_ATTRIBUTE_ALLOWLIST convention.
func AppNameFromPrincipal ¶ added in v1.25.4
AppNameFromPrincipal returns the bare application name from an "app/<name>" principal, or "" if principal is not a confidential-client app principal.
func BatchEnforce ¶
func BatchEnforce(permission *Permission, requests [][]string, permissionIds ...string) ([]bool, error)
func CheckAccountItemModifyRule ¶
func CheckAccountItemModifyRule(accountItem *AccountItem, isAdmin bool, lang string) (bool, string)
func CheckApiPermission ¶
func CheckCasLogin ¶
func CheckCasLogin(application *Application, lang string, service string) error
func CheckConsentRequired ¶
func CheckConsentRequired(userObj *User, application *Application, scopeStr string) (bool, error)
CheckConsentRequired checks if user consent is required for the OAuth flow
func CheckEntryIp ¶
func CheckEntryIp(clientIp string, user *User, application *Application, organization *Organization, lang string) error
func CheckIpWhitelist ¶
func CheckLdapExist ¶
func CheckLdapUserPassword ¶
func CheckLoginPermission ¶
func CheckLoginPermission(userId string, application *Application) (bool, error)
func CheckPassword ¶
func CheckPasswordComplexity ¶
func CheckPasswordComplexityByOrg ¶
func CheckPasswordComplexityByOrg(organization *Organization, password string, lang string) string
func CheckPasswordNotSameAsCurrent ¶
func CheckPasswordNotSameAsCurrent(user *User, newPassword string, organization *Organization) bool
CheckPasswordNotSameAsCurrent checks if the new password is different from the current password
func CheckSigninCode ¶
func CheckToEnableCaptcha ¶
func CheckToEnableCaptcha(application *Application, organization, username string, clientIp string) (bool, error)
func CheckUpdateUser ¶
func CheckUserIsAdminRaw ¶
CheckUserIsAdminRaw bypasses xorm ORM and queries the database directly to check the is_admin boolean field. This works around a known issue where xorm may fail to correctly deserialize boolean columns from Postgres, causing user.IsAdmin to always read as false.
func CheckUserPermission ¶
func CheckUserSignup ¶
func CheckUserSignup(application *Application, organization *Organization, authForm *form.AuthForm, lang string) string
func CheckUsername ¶
func CheckUsernameWithEmail ¶
func CleanupExpiredRevokedTokens ¶
CleanupExpiredRevokedTokens removes revoked tokens that have passed their original expiration time. This prevents the revocation table from growing indefinitely.
func CleanupTokens ¶
func ClearThroughputPerSecond ¶
func ClearThroughputPerSecond()
func ContextWithOrgEngine ¶
ContextWithOrgEngine stores an org-scoped engine in the context.
func ConvertCurrency ¶
ConvertCurrency converts an amount from one currency to another using exchange rates
func CopyUsersPerOrg ¶ added in v1.22.1
func CopyUsersPerOrg(target *MigrationTarget, rows []map[string]any) (copied, dropped int64, orgs int, err error)
CopyUsersPerOrg routes User rows to their per-org enveloped engines, grouped by the row's `owner` (the runtime's orgEngine routing). Each row is a column→value map whose values are already the faithful Go types (nil for NULL). Returns (copied, dropped, distinct-orgs, err); dropped counts duplicate-pkey rows that INSERT OR IGNORE skipped.
func CreateTables ¶
func CreateTables()
func DeleteAdapter ¶
func DeleteApplication ¶
func DeleteApplication(application *Application) (bool, error)
func DeleteBeegoSession ¶
func DeleteBeegoSession(sessionIds []string)
func DeleteCert ¶
func DeleteEnforcer ¶
func DeleteForm ¶
func DeleteGroup ¶
func DeleteInvitation ¶
func DeleteInvitation(invitation *Invitation) (bool, error)
func DeleteLdap ¶
func DeleteModel ¶
func DeleteOrganization ¶
func DeleteOrganization(organization *Organization) (bool, error)
func DeletePermission ¶
func DeletePermission(permission *Permission) (bool, error)
func DeleteProject ¶
func DeleteProvider ¶
func DeleteRadiusAccounting ¶
func DeleteRadiusAccounting(ra *RadiusAccounting) error
func DeleteResource ¶
func DeleteRole ¶
func DeleteRule ¶
func DeleteServer ¶
func DeleteSession ¶
func DeleteSite ¶
func DeleteSyncer ¶
func DeleteTicket ¶
func DeleteToken ¶
func DeleteUser ¶
func DeleteWalletLink ¶ added in v1.22.1
func DeleteWalletLink(link *WalletLink) (bool, error)
func DeleteWebhook ¶
func DeliverOTPViaNotify ¶ added in v1.18.7
func DeliverOTPViaNotify(ctx context.Context, in NotifySendInput) error
DeliverOTPViaNotify is the entry point SendSms / SendEmail call when NotifyDeliveryEnabled() is true. The OTP is `content` for SMS and resolved out of the rendered email body for email. To keep the call site simple, SendSms / SendEmail pre-extract the OTP code and pass it here as `otp`.
Returns nil on success, error on transport / 4xx / 5xx.
func DialWithCert ¶
func DialWithPassword ¶
func DialWithPrivateKey ¶
func DisableVerificationCode ¶
func DisabledMultiFactorAuth ¶
func DownloadAndUpload ¶
func DropBogusEnforcerColumn ¶ added in v1.22.1
DropBogusEnforcerColumn removes the spurious `enforcer TEXT NULL` column that xorm Sync2 adds to the `enforcer` table from object.Enforcer's anonymous *authz.Enforcer embed (no `xorm:"-"` tag). It is invisible on Postgres but materialises on SQLite and then triggers a cascade-scan failure. The Enforcer model lives on the GLOBAL engine, so the drop is applied there. A fresh Sync2 re-adds the column until the upstream struct tags the embed, hence this is re-applied by every migrator before copy. SELECTs from the source must also omit this column (the source — if it was itself migrated — may or may not have it; a per-column reader that reads the destination column set avoids it).
func DumpToFile ¶
func Enforce ¶
func Enforce(permission *Permission, request []string, permissionIds ...string) (bool, error)
func EnforceNotifyDeliveryGuard ¶ added in v1.18.7
func EnforceNotifyDeliveryGuard()
EnforceNotifyDeliveryGuard runs at boot. Same idiom as EnforceOTPProviderGuard — validate config once, cache, fail loud on missing required env.
IAM_NOTIFY_URL=stub or "" → disabled (legacy path runs). IAM_NOTIFY_URL=<url> → enabled; URL parsed for sanity at boot.
IAM_NOTIFY_TOKEN may be empty for local dev (notify must run with auth off in that mode). Production manifests MUST set both URL + token; the operator wires them from KMS.
func EnforceOTPProviderGuard ¶ added in v1.18.4
func EnforceOTPProviderGuard()
EnforceOTPProviderGuard is a no-op. Kept so iamserver.Init() compiles unchanged after the env-direct provider paths were ripped.
func EvictAppCache ¶
func EvictAppCache(owner, name string)
EvictAppCache removes a cached application. Call after any write.
func EvictAppCacheByClientId ¶
func EvictAppCacheByClientId(clientId string)
EvictAppCacheByClientId removes a cached client_id mapping.
func EvictCertCache ¶
func EvictCertCache(name string)
EvictCertCache removes a cached cert and its parsed key.
func EvictOrgCache ¶
func EvictOrgCache(owner, name string)
EvictOrgCache removes a cached organization. Call after any write.
func EvictPermCache ¶
func EvictPermCache(userId string)
EvictPermCache removes only the permission graph for userId. Call after any role/permission assignment change.
func EvictUserCache ¶
func EvictUserCache(owner, name string)
EvictUserCache removes the user row and permission graph from cache. Call this after any write that modifies a User record.
func ExpireTokenByAccessToken ¶
func ExpireTokenByAccessToken(accessToken string) (bool, *Application, *Token, error)
func ExpireTokenByUser ¶
func ExtendGroupWithUsers ¶
func ExtendGroupsWithUsers ¶
func FromProviderToIdpInfo ¶
func GenerateId ¶
func GenerateId()
func GenerateIdForNewUser ¶
func GenerateIdForNewUser(application *Application) (string, error)
func GenerateSamlRequest ¶
func GetAdapterCount ¶
func GetAllActions ¶
func GetAllObjects ¶
func GetAllRoles ¶
func GetApiKeyToken ¶
func GetApiKeyToken(application *Application, accessKey string, accessSecret string, scope string, host string) (*Token, *TokenError, error)
GetApiKeyToken exchanges a user's API key (access_key + access_secret) for a user-bound OAuth token. This enables machine-to-machine authentication using long-lived API keys instead of username/password (ROPC).
func GetApplicationCount ¶
func GetAuthorizationCodeToken ¶
func GetAuthorizationCodeToken(application *Application, clientSecret string, code string, verifier string, resource string) (*Token, *TokenError, error)
GetAuthorizationCodeToken Authorization code flow
func GetBuiltInModel ¶
func GetBuiltInModel(modelText string) (authzmodel.Model, error)
func GetCaptcha ¶
func GetCertCount ¶
func GetClientCredentialsToken ¶
func GetClientCredentialsToken(application *Application, clientSecret string, scope string, host string) (*Token, *TokenError, error)
GetClientCredentialsToken Client Credentials flow
func GetDeviceCodeToken ¶ added in v1.28.2
func GetDeviceCodeToken(application *Application, deviceAuth *DeviceAuthCache, nonce string, host string) (*Token, *TokenError, error)
GetDeviceCodeToken issues a token for the user who approved a device authorization request (RFC 8628). Identity, scope, and approval all come from deviceAuth — the device-auth cache entry the controller consumed — and NEVER from request parameters: a caller cannot pass a username. The function is fail-closed and safe regardless of caller — it re-asserts the authorization was approved (deviceAuthApprovedError) before minting, so the "the controller already verified this" precondition is enforced here, not merely assumed. There is deliberately no secret/password check: the human authenticating and approving interactively at the verification URI is the authentication.
func GetDomainExpireTime ¶
func GetEnforcerCount ¶
func GetExchangeRate ¶
GetExchangeRate returns the exchange rate from fromCurrency to toCurrency
func GetExportFilePath ¶
func GetExportFilePath() string
func GetFaviconUrl ¶
func GetFilteredPolicies ¶
func GetFilteredPoliciesMulti ¶
GetFilteredPoliciesMulti applies multiple filters to policies Doing this in our loop is more efficient than using GetFilteredGroupingPolicy / GetFilteredPolicy which iterates over all policies again and again
func GetGlobalCertsCount ¶
func GetGlobalKeyCount ¶
func GetGlobalProviderCount ¶
func GetGlobalUserCount ¶
func GetGroupCount ¶
func GetGroupWithPrefix ¶
func GetGroupWithoutPrefix ¶
func GetIdvProviderFromProvider ¶
func GetIdvProviderFromProvider(provider *Provider) idv.IdvProvider
func GetImplicitToken ¶
func GetImplicitToken(application *Application, username string, scope string, nonce string, host string) (*Token, *TokenError, error)
GetImplicitToken Implicit flow
func GetInitDataDiagnostics ¶
func GetInitDataDiagnostics() map[string]interface{}
GetInitDataDiagnostics returns a safe summary of init data sync status. Does NOT expose DB schema, indexes, raw SQL, or internal state in production.
func GetInvitationCount ¶
func GetJwksBytes ¶ added in v1.14.15
GetJwksBytes returns the JSON-encoded JWKS for the given application (empty == global). Reads are lock-free on a cache hit; misses do one computation under a single-flight mutex.
The returned []byte is owned by the cache — callers MUST NOT mutate it. Treat it as read-only.
func GetJwtBearerToken ¶
func GetJwtBearerToken(application *Application, assertion string, scope string, nonce string, host string) (*Token, *TokenError, error)
GetJwtBearerToken RFC 7523
func GetKeyCount ¶
func GetModelCount ¶
func GetOAuthToken ¶
func GetOAuthToken(grantType string, clientId string, clientSecret string, code string, verifier string, scope string, nonce string, username string, password string, host string, refreshToken string, tag string, avatar string, lang string, subjectToken string, subjectTokenType string, assertion string, clientAssertion string, clientAssertionType string, audience string, resource string, accessKey string, accessSecret string) (interface{}, error)
func GetOrgEngineFromContext ¶
GetOrgEngineFromContext retrieves the org-scoped engine from context. Falls back to the global engine if not set.
func GetOrganizationCount ¶
func GetPasswordToken ¶
func GetPasswordToken(application *Application, username string, password string, scope string, host string) (*Token, *TokenError, error)
GetPasswordToken Resource Owner Password Credentials flow
func GetPermissionCount ¶
func GetProjectCount ¶
func GetProviderCount ¶
func GetResourceCount ¶
func GetRevokedTokenCount ¶
GetRevokedTokenCount returns the count of revoked tokens for an application.
func GetRoleCount ¶
func GetRuleCount ¶
func GetSamlRedirectAddress ¶
func GetSamlResponse ¶
func GetSamlResponse(application *Application, user *User, samlRequest string, host string) (string, string, string, error)
GetSamlResponse generates a SAML2.0 response parameter samlRequest is saml request in base64 format
func GetServerCount ¶
func GetSession ¶
func GetSessionCount ¶
func GetSessionForUser ¶
func GetSiteCount ¶
func GetSyncerCount ¶
func GetTicketCount ¶
func GetTokenCount ¶
func GetTokenExchangeToken ¶
func GetTokenExchangeToken(application *Application, clientSecret string, subjectToken string, subjectTokenType string, audience string, scope string, host string) (*Token, *TokenError, error)
GetTokenExchangeToken Token Exchange Grant (RFC 8693) Exchanges a subject token for a new token with different audience or scope
func GetTruncatedPath ¶
func GetUploadFileUrl ¶
func GetUserField ¶
func GetUserFieldStringValue ¶
func GetUserOAuthAccessToken ¶
GetUserOAuthAccessToken retrieves the OAuth access token for a specific provider
func GetUserOAuthRefreshToken ¶
GetUserOAuthRefreshToken retrieves the OAuth refresh token for a specific provider
func GetValidationBySaml ¶
GetValidationBySaml * @ret1: saml response @ret2: the service URL who requested to issue this token @ret3: error
func GetVerificationCount ¶
func GetVerifyType ¶
func GetWebhookCount ¶
func GetWechatMiniProgramToken ¶
func GetWechatMiniProgramToken(application *Application, code string, host string, username string, avatar string, lang string) (*Token, *TokenError, error)
GetWechatMiniProgramToken Wechat Mini Program flow
func GroupChangeTrigger ¶
func GroupPermissionsByModelAdapter ¶
func GroupPermissionsByModelAdapter(permissions []*Permission) map[string][]string
GroupPermissionsByModelAdapter group permissions by model and adapter. Every model and adapter will be a key, and the value is a list of permission ids. With each list of permission ids have the same key, we just need to init the enforcer and do the enforce/batch-enforce once (with list of permission ids as the policyFilter when the enforcer load policy).
func HasRoleDefinition ¶
func HasRoleDefinition(m authzmodel.Model) bool
func InitAdapter ¶
func InitAdapter()
func InitCleanupTokens ¶
func InitCleanupTokens()
func InitConfig ¶
func InitConfig()
func InitDb ¶
func InitDb()
InitDb is the bootstrap entrypoint: it seeds the admin org, the IAM application, the bootstrap admin user, and the authz primitives (model, adapter, enforcer, permission). All seeds are idempotent — if a row already exists with the canonical (owner, name), the seed is skipped.
func InitDefaultStorageProvider ¶
func InitDefaultStorageProvider()
func InitFromFile ¶
func InitFromFile()
func InitKMS ¶
func InitKMS()
InitKMS connects to the native-ZAP base KMS plugin, fetches the bootstrap secrets, and overrides Beego config values for infrastructure secrets (e.g. dataSourceName). Must be called before InitAdapter().
When KMS_ADDR is unset, KMS is disabled and this function is a no-op. The caller is expected to fall back to plain environment variables in that case.
func InitLdapAutoSynchronizer ¶
func InitLdapAutoSynchronizer()
func InitRuleMap ¶
func InitRuleMap()
func InitSiteMap ¶
func InitSiteMap()
func InitUserManager ¶
func InitUserManager()
func InsertRows ¶ added in v1.22.1
func InsertRows(eng *xorm.Engine, table string, rows []map[string]any) (copied, dropped int64, err error)
InsertRows inserts faithfully-typed rows into the destination engine inside a single transaction. INSERT OR IGNORE drops a source-side duplicate-pkey row instead of aborting the whole table (the report surfaces the delta). Raw database/sql is used (NOT xorm.Session.Exec) so a Go nil is written as SQL NULL rather than coerced to ""/0/false — see the NULL-fidelity note at the top of this file. Each row's value for a column MUST already be the destination Go type produced by the source reader (nil | int64 | float64 | string | []byte); no coercion happens here, by design.
Returns (copied, dropped, err): copied = rows landed, dropped = duplicates.
func InterimUpdateRadiusAccounting ¶
func InterimUpdateRadiusAccounting(oldRa *RadiusAccounting, newRa *RadiusAccounting, stop bool) error
func InvalidateJwksCache ¶ added in v1.14.15
func InvalidateJwksCache()
InvalidateJwksCache clears the cache, forcing the next GetJwksBytes call to recompute. Wire this into any code path that mutates a Cert row (key rotation, cert delete, application cert reassignment).
func IsAllowSend ¶
func IsAllowSend(user *User, remoteAddr, recordType string, application *Application) error
func IsGrantTypeValid ¶
IsGrantTypeValid Check if grantType is allowed in the current application authorization_code is allowed by default
func IsNeedPromptMfa ¶
func IsNeedPromptMfa(org *Organization, user *User) bool
func IsOriginAllowed ¶
func IsScopeValid ¶
func IsScopeValid(scope string, application *Application) bool
IsScopeValid checks whether all space-separated scopes in the scope string are defined in the application's Scopes list (including regex expansion). If the application has no defined scopes, every scope is considered valid (backward-compatible behaviour).
func IsScopeValidAndExpand ¶
func IsScopeValidAndExpand(scope string, application *Application) (string, bool)
IsScopeValidAndExpand expands any regex patterns in the space-separated scope string against the application's configured scopes. Literal scopes are kept as-is after verifying they exist in the allowed list. Regex scopes are matched against every allowed scope name; all matches replace the pattern. If the application has no defined scopes, the original scope string is returned unchanged (backward-compatible behaviour). Returns the expanded scope string and whether the scope is valid.
func IsServedHost ¶ added in v1.28.2
IsServedHost reports whether `host` belongs to a domain IAM is configured to serve. When no allowlist is configured (e.g. local dev) it returns true so behavior is unchanged. Used to reject an attacker-supplied X-Forwarded-Host.
func IsSupportedWeb3Chain ¶ added in v1.22.1
IsSupportedWeb3Chain reports whether a chain family is one this build knows. Per-chain *verifier* readiness is a separate gate (the frontend ENABLED_CHAINS list); an enabled-but-unverifiable chain fails closed in VerifyProof.
func IsTokenRevoked ¶
IsTokenRevoked checks if a token has been revoked.
func IsTokenRevokedByHash ¶
IsTokenRevokedByHash checks if a token has been revoked by its hash.
func MfaRecover ¶
func MigratePhoneToE164 ¶ added in v1.18.7
MigratePhoneToE164 walks every user row whose `phone` does not start with '+' and rewrites it to its canonical E.164 form using the adjacent `country_code` column. Idempotent — re-running it is a cheap no-op once every row is already E.164.
Rows whose `(phone, country_code)` pair cannot be parsed by libphonenumber are LEFT UNCHANGED and logged. Those are typically fixture rows (e.g. `1337000001`, `9999999999`) that were never real dialable numbers; they continue to be reachable via the by-attribute endpoint's literal fallback, but they will not collide with new E.164 writes.
Schema change: NONE. The migration mutates row values inside the existing `phone` VARCHAR column; no DDL is required.
Returns (updated, skipped, error). `updated` is the count of rows whose phone was rewritten to E.164. `skipped` is the count of rows whose phone could not be parsed and was left alone.
func MoveUserToOrg ¶
MoveUserToOrg changes a user's owner (organization) field. Since owner is part of the composite primary key in IAM, this uses xorm's Exec for a direct SQL UPDATE.
func NewSamlResponse ¶
func NewSamlResponse(application *Application, user *User, host string, certificate string, destination string, iss string, requestId string, redirectUri []string) (*etree.Element, error)
NewSamlResponse returns a saml2 response
func NewSamlResponse11 ¶
func NewSamlResponse11(application *Application, user *User, requestID string, host string) (*etree.Element, error)
NewSamlResponse11 return a saml1.1 response(not 2.0)
func NotifyDeliveryEnabled ¶ added in v1.18.7
func NotifyDeliveryEnabled() bool
NotifyDeliveryEnabled returns true when EnforceNotifyDeliveryGuard resolved IAM_NOTIFY_URL to something usable. SendSms / SendEmail branch on this before any other provider lookup.
func OrgIsolationEnabled ¶
func OrgIsolationEnabled() bool
OrgIsolationEnabled returns true if per-org SQLite isolation is active.
func ParseSamlResponse ¶
func PromoteByEmailDomain ¶ added in v1.18.1
PromoteByEmailDomain applies the email-domain promotion rule to the given user. It is idempotent: if the user is already in the target org with the required IsAdmin flag, it is a no-op.
Returns true if any DB mutation occurred. Callers (HandleLoggedIn etc.) should log promotion events but MUST NOT fail the signin on promotion error — promotion is best-effort; an unexpected DB error here must not lock the user out of their session.
func ProvisionAuthzTables ¶ added in v1.22.1
ProvisionAuthzTables creates the runtime-allocated authz adapter tables on the GLOBAL engine (authz is not per-org), exactly as the running IAM does on its first request. Idempotent: authzstore.New is a CREATE TABLE IF NOT EXISTS.
func PurgeExpiredWeb3Nonces ¶ added in v1.22.1
PurgeExpiredWeb3Nonces is a janitor for a periodic task (optional).
func RefreshToken ¶
func RegisterDynamicClient ¶
func RegisterDynamicClient(req *DynamicClientRegistrationRequest, organization string) (*DynamicClientRegistrationResponse, *DcrError, error)
RegisterDynamicClient creates a new application based on DCR request
func ResetLdapPassword ¶
func RevokeToken ¶
func RevokeToken(tokenValue string, tokenType string, revokedBy string, clientId string, owner string, application string, expiresAt time.Time) error
RevokeToken revokes an OAuth2 token (access_token or refresh_token). This implements RFC 7009 - OAuth 2.0 Token Revocation.
func RevokeTokenByHash ¶
func RevokeTokenByHash(tokenHash string, tokenType string, revokedBy string, clientId string, owner string, application string, expiresAt time.Time) error
RevokeTokenByHash revokes a token by its hash value.
func RevokeUserKeys ¶ added in v1.25.3
RevokeUserKeys clears a user's per-user hk- AccessKey/AccessSecret (the self-serve Cloud API key). Column-scoped for the same reason as AddUserKeys — it must never re-validate the (possibly email-named) `name`.
func RunSyncUsersJob ¶
func RunSyncUsersJob()
func SandboxOTPAllowed ¶ added in v1.18.4
func SandboxOTPAllowed() bool
SandboxOTPAllowed always returns true. See file comment above for the rationale — the authoritative SANDBOX_GLOBAL_OTP gate is the origin guard at boot, not a read-side mode check.
func SanitizePolicyJsonArrays ¶ added in v1.19.4
SanitizePolicyJsonArrays repairs PostgreSQL array-literal residue in the JSON-backed []string columns of the `permission` and `role` tables.
Background: these columns (users, roles, groups, domains, resources, actions) are declared `xorm:"mediumtext"` and stored as JSON. When a row was written under the Postgres driver and later migrated to SQLite verbatim, some values landed as Postgres array literals — e.g. the bytes `{admin/*}` instead of the JSON `["admin/*"]`. Go's encoding/json then chokes on the very first row scan with
invalid character 'a' looking for beginning of object key string
and because the Casbin enforcer / CheckApiPermission path wraps that scan error in panic(err), a SINGLE corrupt permission row takes down ALL authorization: every list endpoint (get-organizations, get-applications, get-permissions, get-roles, ...) returns the panic instead of data, and the login SPA's post-auth account/user fetches fail — stranding users on a dead-button "Binding providers" prompt.
This migration normalizes that residue back to valid JSON arrays so a lone bad row can never again poison the enforcer. It operates on RAW column text via the driver (Query/Exec), so it cannot itself trip the unmarshal panic it exists to prevent.
Idempotent: a value that is already valid JSON (`[...]`, `null`, or empty) is left untouched, so re-running on every boot is a cheap no-op once clean.
Schema change: NONE. Values are rewritten inside existing columns.
Returns (updated, error). `updated` counts the (row, column) cells rewritten.
func SendNotification ¶
func SendSsoLogoutNotifications ¶
SendSsoLogoutNotifications sends logout notifications to all notification providers configured in the user's signup application
func SendVerificationCodeToEmail ¶
func SendVerificationCodeToEmail(organization *Organization, user *User, provider *Provider, remoteAddr string, dest string, _ string, _ string, _ string, application *Application) error
SendVerificationCodeToEmail generates an OTP and dispatches it via hanzoai/notify. The notify service owns the per-tenant template, the SendGrid/SMTP/Resend provider selection, retry, and metering — IAM only hands it the OTP and the recipient. The IAM-side verification record + rate limit run locally so DB consistency does not depend on notify's response shape.
`provider` is preserved in the signature for call-site source compatibility with the controller. Its Name/Category are recorded in the local verification record; everything else (Title, Content, ClientId/ClientSecret) is ignored — notify holds the canonical template + credentials.
Returns an error if notify delivery is disabled. There is no in-process fallback; refusing to send is the correct behaviour when the canonical send path is unavailable.
func SendVerificationCodeToPhone ¶
func SendVerificationCodeToPhone(organization *Organization, user *User, provider *Provider, remoteAddr string, dest string, application *Application) error
SendVerificationCodeToPhone generates an OTP and dispatches it via hanzoai/notify. notify resolves the per-tenant SMS provider, renders the iam.otp_sent template, sends, and records a meter row. IAM owns the verification record + rate limiting.
Per-user pinned OTP (user.VerificationCode set, e.g. for sandbox users) skips the send entirely and just records the code — the pinned-OTP demo path is intentionally provider-independent.
`provider` is preserved in the signature for call-site source compatibility with the controller. Its Name/Category are recorded in the local verification record; everything else is ignored.
Returns an error if notify delivery is disabled and the user is not using a pinned OTP. There is no in-process fallback.
func SendWebhooks ¶
func SetNotifyDeliverer ¶ added in v1.18.7
func SetNotifyDeliverer(d notifyDeliverer) notifyDeliverer
SetNotifyDeliverer is a test seam. Production code never calls this; the boot guard installs the HTTP deliverer once. Returns the previous deliverer so tests can restore via defer.
func SetUserOAuthProperties ¶
func ShouldExportData ¶
func ShouldExportData() bool
func SplitOriginList ¶ added in v1.14.24
SplitOriginList parses a comma-separated origin config value into a slice of trimmed origins. Empty entries are dropped. Returns nil for empty input.
Multi-tenant IAM serves many host names from one backend, so `origin` (and `originFrontend`) in app.conf may be either a single origin or a CSV. The discovery endpoint must emit exactly one issuer per request — the one that matches the incoming host — not the entire CSV joined back together.
func StartMonitorSitesLoop ¶
func StartMonitorSitesLoop()
func StoreCasTokenForPgt ¶
func StoreCasTokenForPgt(token *CasAuthenticationSuccess, service, userId string) string
func StoreCasTokenForProxyTicket ¶
func StoreCasTokenForProxyTicket(token *CasAuthenticationSuccess, targetService, userId string) string
func StringArrayToStruct ¶
func SyncLdapGroups ¶
func SyncLdapGroups(owner string, ldapGroups []LdapGroup, ldapId string) (newGroups int, updatedGroups int, err error)
SyncLdapGroups syncs LDAP groups/OUs to IAM groups with hierarchy
func SyncLdapUsers ¶
func TestSyncer ¶
func TriggerWebhookForUser ¶
TriggerWebhookForUser triggers a webhook for user operations (add, update, delete) action: the action type, e.g., "new-user", "update-user", "delete-user" user: the user object
func UpdateApplication ¶
func UpdateInvitation ¶
func UpdateInvitation(id string, invitation *Invitation, lang string) (bool, error)
func UpdateLdap ¶
func UpdateLdapSyncTime ¶
func UpdateModelWithCheck ¶
func UpdateOrganization ¶
func UpdateOrganization(id string, organization *Organization, isGlobalAdmin bool) (bool, error)
func UpdatePermission ¶
func UpdatePermission(id string, permission *Permission) (bool, error)
func UpdatePolicy ¶
func UpdateRadiusAccounting ¶
func UpdateRadiusAccounting(id string, ra *RadiusAccounting) error
func UpdateSyncer ¶
func UpdateUser ¶
func UpdateUserBalance ¶
func UpdateWebhook ¶
func UploadFileSafe ¶
func UploadUsers ¶
func ValidateKerberosToken ¶
func ValidateKerberosToken(organization *Organization, spnegoTokenBase64 string) (string, error)
ValidateKerberosToken validates a base64-encoded SPNEGO token from the Authorization header and returns the authenticated Kerberos username.
func VerifyCaptcha ¶
func VerifyInvitation ¶
func VerifySsoLogoutSignature ¶
func VerifySsoLogoutSignature(clientSecret string, notification *SsoLogoutNotification) bool
VerifySsoLogoutSignature verifies the signature of an SSO logout notification This should be called by applications receiving logout notifications
Types ¶
type AccountItem ¶
type AccountItem struct {
Name string `json:"name"`
Visible bool `json:"visible"`
ViewRule string `json:"viewRule"`
ModifyRule string `json:"modifyRule"`
Regex string `json:"regex"`
Tab string `json:"tab"`
}
func GetAccountItemByName ¶
func GetAccountItemByName(name string, organization *Organization) *AccountItem
type ActiveDirectorySyncerProvider ¶
type ActiveDirectorySyncerProvider struct {
Syncer *Syncer
}
ActiveDirectorySyncerProvider implements SyncerProvider for Active Directory LDAP-based syncers
func (*ActiveDirectorySyncerProvider) AddUser ¶
func (p *ActiveDirectorySyncerProvider) AddUser(user *OriginalUser) (bool, error)
AddUser adds a new user to Active Directory (not supported for read-only LDAP)
func (*ActiveDirectorySyncerProvider) Close ¶
func (p *ActiveDirectorySyncerProvider) Close() error
Close closes any open connections (no-op for Active Directory LDAP-based syncer)
func (*ActiveDirectorySyncerProvider) GetOriginalGroups ¶
func (p *ActiveDirectorySyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups from Active Directory (not implemented yet)
func (*ActiveDirectorySyncerProvider) GetOriginalUserGroups ¶
func (p *ActiveDirectorySyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group IDs that a user belongs to (not implemented yet)
func (*ActiveDirectorySyncerProvider) GetOriginalUsers ¶
func (p *ActiveDirectorySyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from Active Directory via LDAP
func (*ActiveDirectorySyncerProvider) InitAdapter ¶
func (p *ActiveDirectorySyncerProvider) InitAdapter() error
InitAdapter initializes the Active Directory syncer (no database adapter needed)
func (*ActiveDirectorySyncerProvider) TestConnection ¶
func (p *ActiveDirectorySyncerProvider) TestConnection() error
TestConnection tests the Active Directory LDAP connection
func (*ActiveDirectorySyncerProvider) UpdateUser ¶
func (p *ActiveDirectorySyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
UpdateUser updates an existing user in Active Directory (not supported for read-only LDAP)
type Adapter ¶
type Adapter struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
Table string `xorm:"varchar(100)" json:"table"`
UseSameDb bool `json:"useSameDb"`
Type string `xorm:"varchar(100)" json:"type"`
DatabaseType string `xorm:"varchar(100)" json:"databaseType"`
Host string `xorm:"varchar(100)" json:"host"`
Port int `json:"port"`
User string `xorm:"varchar(100)" json:"user"`
Password string `xorm:"varchar(150)" json:"password"`
Database string `xorm:"varchar(100)" json:"database"`
*authzstore.Adapter `xorm:"-" json:"-"`
// contains filtered or unexported fields
}
func GetAdapter ¶
func GetAdapters ¶
func GetPaginationAdapters ¶
func (*Adapter) InitAdapter ¶
type Address ¶
type Address struct {
Tag string `xorm:"varchar(100)" json:"tag"`
Line1 string `xorm:"varchar(100)" json:"line1"`
Line2 string `xorm:"varchar(100)" json:"line2"`
City string `xorm:"varchar(100)" json:"city"`
State string `xorm:"varchar(100)" json:"state"`
ZipCode string `xorm:"varchar(100)" json:"zipCode"`
Region string `xorm:"varchar(100)" json:"region"`
}
type Affiliation ¶
type AppAdminCapability ¶ added in v1.25.4
type AppAdminCapability struct {
// Name is a short, stable identifier (used in logs/audit/errors).
Name string
// EnvVar is the environment variable holding the comma-separated
// allowlist of application names permitted to exercise this capability
// via an "app/<name>" credential. Empty/unset = deny all (fail-secure).
EnvVar string
}
AppAdminCapability names a sensitive, app-gated capability and the env var holding its fail-secure allowlist of application names.
type Application ¶
type Application struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Category string `xorm:"varchar(20)" json:"category"`
Type string `xorm:"varchar(20)" json:"type"`
Scopes []*ScopeItem `xorm:"mediumtext" json:"scopes"`
Logo string `xorm:"varchar(200)" json:"logo"`
Title string `xorm:"varchar(100)" json:"title"`
Favicon string `xorm:"varchar(200)" json:"favicon"`
Order int `json:"order"`
HomepageUrl string `xorm:"varchar(100)" json:"homepageUrl"`
Description string `xorm:"varchar(100)" json:"description"`
Organization string `xorm:"varchar(100)" json:"organization"`
Cert string `xorm:"varchar(100)" json:"cert"`
DefaultGroup string `xorm:"varchar(100)" json:"defaultGroup"`
HeaderHtml string `xorm:"mediumtext" json:"headerHtml"`
EnablePassword bool `xorm:"bool" json:"enablePassword"`
EnableSignUp bool `xorm:"bool" json:"enableSignUp"`
DisableSignin bool `xorm:"bool" json:"disableSignin"`
EnableSigninSession bool `xorm:"bool" json:"enableSigninSession"`
EnableAutoSignin bool `xorm:"bool" json:"enableAutoSignin"`
EnableCodeSignin bool `xorm:"bool" json:"enableCodeSignin"`
EnableExclusiveSignin bool `xorm:"bool" json:"enableExclusiveSignin"`
EnableSamlCompress bool `xorm:"bool" json:"enableSamlCompress"`
EnableSamlC14n10 bool `xorm:"bool" json:"enableSamlC14n10"`
EnableSamlPostBinding bool `xorm:"bool" json:"enableSamlPostBinding"`
DisableSamlAttributes bool `xorm:"bool" json:"disableSamlAttributes"`
EnableSamlAssertionSignature bool `xorm:"bool" json:"enableSamlAssertionSignature"`
UseEmailAsSamlNameId bool `xorm:"bool" json:"useEmailAsSamlNameId"`
EnableWebAuthn bool `xorm:"bool" json:"enableWebAuthn"`
EnableLinkWithEmail bool `xorm:"bool" json:"enableLinkWithEmail"`
OrgChoiceMode string `json:"orgChoiceMode"`
SamlReplyUrl string `xorm:"varchar(500)" json:"samlReplyUrl"`
Providers []*ProviderItem `xorm:"mediumtext" json:"providers"`
SigninMethods []*SigninMethod `xorm:"mediumtext" json:"signinMethods"`
SignupItems []*SignupItem `xorm:"mediumtext" json:"signupItems"`
SigninItems []*SigninItem `xorm:"mediumtext" json:"signinItems"`
GrantTypes []string `xorm:"mediumtext" json:"grantTypes"`
OrganizationObj *Organization `xorm:"-" json:"organizationObj"`
CertPublicKey string `xorm:"-" json:"certPublicKey"`
Tags []string `xorm:"mediumtext" json:"tags"`
SamlAttributes []*SamlItem `xorm:"mediumtext" json:"samlAttributes"`
SamlHashAlgorithm string `xorm:"varchar(20)" json:"samlHashAlgorithm"`
IpRestriction string `json:"ipRestriction"`
ClientId string `xorm:"varchar(100)" json:"clientId"`
ClientSecret string `xorm:"varchar(100)" json:"clientSecret"`
ClientCert string `xorm:"varchar(100)" json:"clientCert"`
RedirectUris []string `xorm:"mediumtext" json:"redirectUris"`
ForcedRedirectOrigin string `xorm:"varchar(100)" json:"forcedRedirectOrigin"`
TokenFormat string `xorm:"varchar(100)" json:"tokenFormat"`
TokenSigningMethod string `xorm:"varchar(100)" json:"tokenSigningMethod"`
TokenFields []string `xorm:"mediumtext" json:"tokenFields"`
TokenAttributes []*JwtItem `xorm:"mediumtext" json:"tokenAttributes"`
ExpireInHours float64 `json:"expireInHours"`
RefreshExpireInHours float64 `json:"refreshExpireInHours"`
CookieExpireInHours int64 `json:"cookieExpireInHours"`
SignupUrl string `xorm:"varchar(200)" json:"signupUrl"`
SigninUrl string `xorm:"varchar(200)" json:"signinUrl"`
ForgetUrl string `xorm:"varchar(200)" json:"forgetUrl"`
AffiliationUrl string `xorm:"varchar(100)" json:"affiliationUrl"`
IpWhitelist string `xorm:"varchar(200)" json:"ipWhitelist"`
TermsOfUse string `xorm:"varchar(200)" json:"termsOfUse"`
SignupHtml string `xorm:"mediumtext" json:"signupHtml"`
SigninHtml string `xorm:"mediumtext" json:"signinHtml"`
ThemeData *ThemeData `xorm:"json" json:"themeData"`
FormCss string `xorm:"text" json:"formCss"`
FormCssMobile string `xorm:"text" json:"formCssMobile"`
FormOffset int `json:"formOffset"`
FormSideHtml string `xorm:"mediumtext" json:"formSideHtml"`
FormBackgroundUrl string `xorm:"varchar(200)" json:"formBackgroundUrl"`
FormBackgroundUrlMobile string `xorm:"varchar(200)" json:"formBackgroundUrlMobile"`
FailedSigninLimit int `json:"failedSigninLimit"`
FailedSigninFrozenTime int `json:"failedSigninFrozenTime"`
CodeResendTimeout int `json:"codeResendTimeout"`
CustomScopes []*ScopeDescription `xorm:"mediumtext" json:"customScopes"`
Environment string `xorm:"varchar(50)" json:"environment"` // dev, staging, production
Project string `xorm:"varchar(100)" json:"project"` // project within org
// Reverse proxy fields
Domain string `xorm:"varchar(100)" json:"domain"`
OtherDomains []string `xorm:"mediumtext" json:"otherDomains"`
UpstreamHost string `xorm:"varchar(100)" json:"upstreamHost"`
SslMode string `xorm:"varchar(100)" json:"sslMode"`
SslCert string `xorm:"varchar(100)" json:"sslCert"`
CertObj *Cert `xorm:"-"`
}
func CheckOAuthLogin ¶
func FindApplicationByName ¶ added in v1.14.6
func FindApplicationByName(name, orgHint string) (*Application, error)
FindApplicationByName resolves an application by its name across the configured admin namespace and a tenant org. Tries `<adminOrg>/<name>` first (system apps + the legacy seed location), then `<orgHint>/<name>` (apps owned by a tenant org), then a global by-name lookup so a caller that doesn't know the owner can still find the row. Returns (nil, nil) if no match.
Use this everywhere a controller currently does `GetApplication("admin/" + appName)` — that hardcoded `admin/` lookup breaks the moment an app is owned by a tenant org (which is the post-init steady state for everything except the admin-owned IAM app).
func GetAllowedApplications ¶
func GetAllowedApplications(applications []*Application, userId string, lang string) ([]*Application, error)
func GetApplication ¶
func GetApplication(id string) (*Application, error)
func GetApplicationByClientId ¶
func GetApplicationByClientId(clientId string) (*Application, error)
func GetApplicationByOrganizationName ¶
func GetApplicationByOrganizationName(organization string) (*Application, error)
func GetApplicationByUser ¶
func GetApplicationByUser(user *User) (*Application, error)
func GetApplicationByUserId ¶
func GetApplicationByUserId(userId string) (application *Application, err error)
func GetApplications ¶
func GetApplications(owner string) ([]*Application, error)
func GetDefaultApplication ¶
func GetDefaultApplication(id string) (*Application, error)
func GetMaskedApplication ¶
func GetMaskedApplication(application *Application, userId string) *Application
func GetMaskedApplications ¶
func GetMaskedApplications(applications []*Application, userId string) []*Application
func GetOrganizationApplications ¶
func GetOrganizationApplications(owner string, organization string) ([]*Application, error)
func GetPaginationApplications ¶
func GetPaginationApplications(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Application, error)
func GetPaginationOrganizationApplications ¶
func GetPaginationOrganizationApplications(owner, organization string, offset, limit int, field, value, sortField, sortOrder string) ([]*Application, error)
func NewAdminApp ¶ added in v1.14.21
func NewAdminApp() *Application
NewAdminApp returns the IAM application placeholder owned by the admin org.
func ValidateClientAssertion ¶
func ValidateClientAssertion(clientAssertion string, host string) (bool, *Application, error)
func (*Application) GetEmailProvider ¶
func (application *Application) GetEmailProvider(method string) (*Provider, error)
func (*Application) GetId ¶
func (application *Application) GetId() string
func (*Application) GetProviderByCategory ¶
func (application *Application) GetProviderByCategory(category string) (*Provider, error)
func (*Application) GetProviderByCategoryAndRule ¶
func (*Application) GetProviderItem ¶
func (application *Application) GetProviderItem(providerName string) *ProviderItem
func (*Application) GetProviderItemByType ¶
func (application *Application) GetProviderItemByType(providerType string) *ProviderItem
func (*Application) GetSignupItemRule ¶
func (application *Application) GetSignupItemRule(itemName string) string
func (*Application) GetSmsProvider ¶
func (application *Application) GetSmsProvider(method string, countryCode string) (*Provider, error)
func (*Application) GetStorageProvider ¶
func (application *Application) GetStorageProvider() (*Provider, error)
func (*Application) HasPromptPage ¶
func (application *Application) HasPromptPage() bool
func (*Application) IsCodeSigninViaEmailEnabled ¶
func (application *Application) IsCodeSigninViaEmailEnabled() bool
func (*Application) IsCodeSigninViaSmsEnabled ¶
func (application *Application) IsCodeSigninViaSmsEnabled() bool
func (*Application) IsFaceIdEnabled ¶
func (application *Application) IsFaceIdEnabled() bool
func (*Application) IsLdapEnabled ¶
func (application *Application) IsLdapEnabled() bool
func (*Application) IsPasswordEnabled ¶
func (application *Application) IsPasswordEnabled() bool
func (*Application) IsPasswordWithLdapEnabled ¶
func (application *Application) IsPasswordWithLdapEnabled() bool
func (*Application) IsRedirectUriValid ¶
func (application *Application) IsRedirectUriValid(redirectUri string) bool
func (*Application) IsSignupItemRequired ¶
func (application *Application) IsSignupItemRequired(itemName string) bool
func (*Application) IsSignupItemVisible ¶
func (application *Application) IsSignupItemVisible(itemName string) bool
type AwsIamSyncerProvider ¶
type AwsIamSyncerProvider struct {
Syncer *Syncer
// contains filtered or unexported fields
}
AwsIamSyncerProvider implements SyncerProvider for AWS IAM API-based syncers
func (*AwsIamSyncerProvider) AddUser ¶
func (p *AwsIamSyncerProvider) AddUser(user *OriginalUser) (bool, error)
AddUser adds a new user to AWS IAM (not supported for read-only API)
func (*AwsIamSyncerProvider) Close ¶
func (p *AwsIamSyncerProvider) Close() error
Close closes any open connections
func (*AwsIamSyncerProvider) GetOriginalGroups ¶
func (p *AwsIamSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups from AWS IAM
func (*AwsIamSyncerProvider) GetOriginalUserGroups ¶
func (p *AwsIamSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group IDs that a user belongs to
func (*AwsIamSyncerProvider) GetOriginalUsers ¶
func (p *AwsIamSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from AWS IAM API
func (*AwsIamSyncerProvider) InitAdapter ¶
func (p *AwsIamSyncerProvider) InitAdapter() error
InitAdapter initializes the AWS IAM syncer
func (*AwsIamSyncerProvider) TestConnection ¶
func (p *AwsIamSyncerProvider) TestConnection() error
TestConnection tests the AWS IAM API connection
func (*AwsIamSyncerProvider) UpdateUser ¶
func (p *AwsIamSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
UpdateUser updates an existing user in AWS IAM (not supported for read-only API)
type AzureAdAccessTokenResp ¶
type AzureAdSyncerProvider ¶
type AzureAdSyncerProvider struct {
Syncer *Syncer
}
AzureAdSyncerProvider implements SyncerProvider for Azure AD API-based syncers
func (*AzureAdSyncerProvider) AddUser ¶
func (p *AzureAdSyncerProvider) AddUser(user *OriginalUser) (bool, error)
AddUser adds a new user to Azure AD (not supported for read-only API)
func (*AzureAdSyncerProvider) Close ¶
func (p *AzureAdSyncerProvider) Close() error
Close closes any open connections (no-op for Azure AD API-based syncer)
func (*AzureAdSyncerProvider) GetOriginalGroups ¶
func (p *AzureAdSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups from Azure AD (not implemented yet)
func (*AzureAdSyncerProvider) GetOriginalUserGroups ¶
func (p *AzureAdSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group IDs that a user belongs to (not implemented yet)
func (*AzureAdSyncerProvider) GetOriginalUsers ¶
func (p *AzureAdSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from Azure AD API
func (*AzureAdSyncerProvider) InitAdapter ¶
func (p *AzureAdSyncerProvider) InitAdapter() error
InitAdapter initializes the Azure AD syncer (no database adapter needed)
func (*AzureAdSyncerProvider) TestConnection ¶
func (p *AzureAdSyncerProvider) TestConnection() error
TestConnection tests the Azure AD API connection
func (*AzureAdSyncerProvider) UpdateUser ¶
func (p *AzureAdSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
UpdateUser updates an existing user in Azure AD (not supported for read-only API)
type AzureAdUser ¶
type AzureAdUser struct {
Id string `json:"id"`
UserPrincipalName string `json:"userPrincipalName"`
DisplayName string `json:"displayName"`
GivenName string `json:"givenName"`
Surname string `json:"surname"`
Mail string `json:"mail"`
MobilePhone string `json:"mobilePhone"`
JobTitle string `json:"jobTitle"`
OfficeLocation string `json:"officeLocation"`
PreferredLanguage string `json:"preferredLanguage"`
AccountEnabled bool `json:"accountEnabled"`
}
type AzureAdUserListResp ¶
type AzureAdUserListResp struct {
OdataContext string `json:"@odata.context"`
OdataNextLink string `json:"@odata.nextLink"`
Value []*AzureAdUser `json:"value"`
}
type CasAnyAttribute ¶
type CasAttributes ¶
type CasAttributes struct {
XMLName xml.Name `xml:"cas:attributes" json:"-"`
AuthenticationDate time.Time `xml:"cas:authenticationDate"`
LongTermAuthenticationRequestTokenUsed bool `xml:"cas:longTermAuthenticationRequestTokenUsed"`
IsFromNewLogin bool `xml:"cas:isFromNewLogin"`
MemberOf []string `xml:"cas:memberOf"`
FirstName string `xml:"cas:firstName,omitempty"`
LastName string `xml:"cas:lastName,omitempty"`
Title string `xml:"cas:title,omitempty"`
Email string `xml:"cas:email,omitempty"`
Affiliation string `xml:"cas:affiliation,omitempty"`
Avatar string `xml:"cas:avatar,omitempty"`
Phone string `xml:"cas:phone,omitempty"`
DisplayName string `xml:"cas:displayName,omitempty"`
UserAttributes *CasUserAttributes
ExtraAttributes []*CasAnyAttribute `xml:",any"`
}
func (*CasAttributes) DeepCopy ¶
func (c *CasAttributes) DeepCopy() CasAttributes
type CasAuthenticationSuccess ¶
type CasAuthenticationSuccess struct {
XMLName xml.Name `xml:"cas:authenticationSuccess" json:"-"`
User string `xml:"cas:user"`
ProxyGrantingTicket string `xml:"cas:proxyGrantingTicket,omitempty"`
Proxies *CasProxies `xml:"cas:proxies"`
Attributes *CasAttributes `xml:"cas:attributes"`
ExtraAttributes []*CasAnyAttribute `xml:",any"`
}
func GetCasTokenByPgt ¶
func GetCasTokenByPgt(pgt string) (bool, *CasAuthenticationSuccess, string, string)
GetCasTokenByPgt * @ret1: whether a token is found @ret2: token, nil if not found @ret3: the service URL who requested to issue this token @ret4: userIf of user who requested to issue this token
func GetCasTokenByTicket ¶
func GetCasTokenByTicket(ticket string) (bool, *CasAuthenticationSuccess, string, string)
GetCasTokenByTicket * @ret1: whether a token is found @ret2: token, nil if not found @ret3: the service URL who requested to issue this token @ret4: userIf of user who requested to issue this token
func (*CasAuthenticationSuccess) DeepCopy ¶
func (c *CasAuthenticationSuccess) DeepCopy() CasAuthenticationSuccess
type CasAuthenticationSuccessWrapper ¶
type CasAuthenticationSuccessWrapper struct {
AuthenticationSuccess *CasAuthenticationSuccess // the token we issued
Service string // to which service this token is issued
UserId string
}
type CasNamedAttribute ¶
type CasProxies ¶
type CasProxies struct {
XMLName xml.Name `xml:"cas:proxies" json:"-"`
Proxies []string `xml:"cas:proxy"`
}
func (*CasProxies) DeepCopy ¶
func (c *CasProxies) DeepCopy() CasProxies
type CasProxyFailure ¶
type CasProxySuccess ¶
type CasServiceResponse ¶
type CasServiceResponse struct {
XMLName xml.Name `xml:"cas:serviceResponse" json:"-"`
Xmlns string `xml:"xmlns:cas,attr"`
Failure *CasAuthenticationFailure
Success *CasAuthenticationSuccess
ProxySuccess *CasProxySuccess
ProxyFailure *CasProxyFailure
}
type CasUserAttributes ¶
type CasUserAttributes struct {
XMLName xml.Name `xml:"cas:userAttributes" json:"-"`
Attributes []*CasNamedAttribute `xml:"cas:attribute"`
AnyAttributes []*CasAnyAttribute `xml:",any"`
}
func (*CasUserAttributes) DeepCopy ¶
func (c *CasUserAttributes) DeepCopy() CasUserAttributes
type Cert ¶
type Cert struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Scope string `xorm:"varchar(100)" json:"scope"`
Type string `xorm:"varchar(100)" json:"type"`
CryptoAlgorithm string `xorm:"varchar(100)" json:"cryptoAlgorithm"`
BitSize int `json:"bitSize"`
ExpireInYears int `json:"expireInYears"`
ExpireTime string `xorm:"varchar(100)" json:"expireTime"`
DomainExpireTime string `xorm:"varchar(100)" json:"domainExpireTime"`
Provider string `xorm:"varchar(100)" json:"provider"`
Account string `xorm:"varchar(100)" json:"account"`
AccessKey string `xorm:"varchar(100)" json:"accessKey"`
AccessSecret string `xorm:"varchar(100)" json:"accessSecret"`
Certificate string `xorm:"mediumtext" json:"certificate"`
PrivateKey string `xorm:"mediumtext" json:"privateKey"`
}
func GetCertByDomain ¶
func GetDefaultCert ¶
func GetGlobalCerts ¶
func GetMaskedCert ¶
func GetPaginationCerts ¶
type Claims ¶
type Claims struct {
*User
TokenType string `json:"tokenType,omitempty"`
Nonce string `json:"nonce,omitempty"`
Tag string `json:"tag"`
Scope string `json:"scope,omitempty"`
// the `azp` (Authorized Party) claim. Optional. See https://openid.net/specs/openid-connect-core-1_0.html#IDToken
Azp string `json:"azp,omitempty"`
Provider string `json:"provider,omitempty"`
SigninMethod string `json:"signinMethod,omitempty"`
jwt.RegisteredClaims
}
func ParseJwtTokenByApplication ¶
func ParseJwtTokenByApplication(token string, application *Application) (*Claims, error)
func ValidateJwtAssertion ¶
type ClaimsShort ¶
type ClaimsShort struct {
*UserShort
// Organization mirrors the embedded user's `owner` under the standard OIDC
// claim name. `owner` is the canonical org claim (gateway → X-Org-Id); this
// alias lets consumers read either, identically across every token format.
Organization string `json:"organization,omitempty"`
TokenType string `json:"tokenType,omitempty"`
Nonce string `json:"nonce,omitempty"`
Scope string `json:"scope,omitempty"`
Azp string `json:"azp,omitempty"`
Provider string `json:"provider,omitempty"`
SigninMethod string `json:"signinMethod,omitempty"`
jwt.RegisteredClaims
}
type ClaimsStandard ¶
type ClaimsStandard struct {
*UserStandard
// Organization mirrors the embedded user's `owner` (see ClaimsShort).
Organization string `json:"organization,omitempty"`
EmailVerified bool `json:"email_verified,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`
PhoneNumberVerified bool `json:"phone_number_verified,omitempty"`
Gender string `json:"gender,omitempty"`
TokenType string `json:"tokenType,omitempty"`
Nonce string `json:"nonce,omitempty"`
Scope string `json:"scope,omitempty"`
Address OIDCAddress `json:"address,omitempty"`
Azp string `json:"azp,omitempty"`
Provider string `json:"provider,omitempty"`
jwt.RegisteredClaims
}
func ParseStandardJwtToken ¶
func ParseStandardJwtToken(token string, cert *Cert) (*ClaimsStandard, error)
func ParseStandardJwtTokenByApplication ¶
func ParseStandardJwtTokenByApplication(token string, application *Application) (*ClaimsStandard, error)
type ClaimsWithoutThirdIdp ¶
type ClaimsWithoutThirdIdp struct {
*UserWithoutThirdIdp
// Organization mirrors the embedded user's `owner` (see ClaimsShort).
Organization string `json:"organization,omitempty"`
TokenType string `json:"tokenType,omitempty"`
Nonce string `json:"nonce,omitempty"`
Tag string `json:"tag"`
Scope string `json:"scope,omitempty"`
Azp string `json:"azp,omitempty"`
Provider string `json:"provider,omitempty"`
SigninMethod string `json:"signinMethod,omitempty"`
jwt.RegisteredClaims
}
type Code ¶
type ConsentRecord ¶
type ConsentRecord struct {
// owner/name
Application string `json:"application"`
GrantedScopes []string `json:"grantedScopes"`
}
ConsentRecord represents the data for OAuth consent API requests/responses
type Credential ¶
type DashboardDateItem ¶
type DashboardDateItem struct {
CreatedTime string `json:"createTime"`
}
type DashboardMapItem ¶
type DashboardMapItem struct {
// contains filtered or unexported fields
}
type DatabaseSyncerProvider ¶
type DatabaseSyncerProvider struct {
Syncer *Syncer
}
DatabaseSyncerProvider implements SyncerProvider for database-based syncers
func (*DatabaseSyncerProvider) AddUser ¶
func (p *DatabaseSyncerProvider) AddUser(user *OriginalUser) (bool, error)
AddUser adds a new user to the database
func (*DatabaseSyncerProvider) Close ¶
func (p *DatabaseSyncerProvider) Close() error
Close closes the database connection and SSH tunnel
func (*DatabaseSyncerProvider) GetOriginalGroups ¶
func (p *DatabaseSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups from Database (not implemented yet)
func (*DatabaseSyncerProvider) GetOriginalUserGroups ¶
func (p *DatabaseSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group IDs that a user belongs to (not implemented yet)
func (*DatabaseSyncerProvider) GetOriginalUsers ¶
func (p *DatabaseSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from the database
func (*DatabaseSyncerProvider) InitAdapter ¶
func (p *DatabaseSyncerProvider) InitAdapter() error
InitAdapter initializes the database adapter
func (*DatabaseSyncerProvider) TestConnection ¶
func (p *DatabaseSyncerProvider) TestConnection() error
TestConnection tests the database connection
func (*DatabaseSyncerProvider) UpdateUser ¶
func (p *DatabaseSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
UpdateUser updates an existing user in the database
type DcrError ¶
type DcrError struct {
Error string `json:"error"`
ErrorDescription string `json:"error_description,omitempty"`
}
DcrError represents an RFC 7591 error response
type DeviceAuthCache ¶
type DeviceAuthResponse ¶
type DeviceAuthResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationUri string `json:"verification_uri"`
VerificationUriComplete string `json:"verification_uri_complete"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
func GetDeviceAuthResponse ¶
func GetDeviceAuthResponse(deviceCode string, userCode string, host string) DeviceAuthResponse
type DingtalkAccessTokenResp ¶
type DingtalkDepartment ¶
type DingtalkDeptDetailResp ¶
type DingtalkDeptDetailResp struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
Result *DingtalkDepartment `json:"result"`
RequestId string `json:"request_id"`
}
type DingtalkDeptListResp ¶
type DingtalkResult ¶
type DingtalkResult struct {
List []*DingtalkUser `json:"list"`
HasMore bool `json:"has_more"`
NextCursor int64 `json:"next_cursor"`
}
type DingtalkSyncerProvider ¶
type DingtalkSyncerProvider struct {
Syncer *Syncer
}
DingtalkSyncerProvider implements SyncerProvider for DingTalk API-based syncers
func (*DingtalkSyncerProvider) AddUser ¶
func (p *DingtalkSyncerProvider) AddUser(user *OriginalUser) (bool, error)
AddUser adds a new user to DingTalk (not supported for read-only API)
func (*DingtalkSyncerProvider) Close ¶
func (p *DingtalkSyncerProvider) Close() error
Close closes any open connections (no-op for DingTalk API-based syncer)
func (*DingtalkSyncerProvider) GetOriginalGroups ¶
func (p *DingtalkSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups (departments) from DingTalk
func (*DingtalkSyncerProvider) GetOriginalUserGroups ¶
func (p *DingtalkSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group (department) IDs that a user belongs to
func (*DingtalkSyncerProvider) GetOriginalUsers ¶
func (p *DingtalkSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from DingTalk API
func (*DingtalkSyncerProvider) InitAdapter ¶
func (p *DingtalkSyncerProvider) InitAdapter() error
InitAdapter initializes the DingTalk syncer (no database adapter needed)
func (*DingtalkSyncerProvider) TestConnection ¶
func (p *DingtalkSyncerProvider) TestConnection() error
TestConnection tests the DingTalk API connection
func (*DingtalkSyncerProvider) UpdateUser ¶
func (p *DingtalkSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
UpdateUser updates an existing user in DingTalk (not supported for read-only API)
type DingtalkUser ¶
type DingtalkUser struct {
UserId string `json:"userid"`
UnionId string `json:"unionid"`
Name string `json:"name"`
Department []int `json:"dept_id_list"`
Position string `json:"title"`
Mobile string `json:"mobile"`
Email string `json:"email"`
Avatar string `json:"avatar"`
JobNumber string `json:"job_number"`
Active bool `json:"active"`
}
type DingtalkUserListResp ¶
type DingtalkUserListResp struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
Result *DingtalkResult `json:"result"`
RequestId string `json:"request_id"`
}
type DomainPromotion ¶ added in v1.18.1
type DomainPromotion struct {
// Org is the user's resulting owner field after promotion.
Org string
// GlobalAdmin reports whether the rule confers global-admin status
// (i.e. Org == conf.AdminOrg).
GlobalAdmin bool
}
DomainPromotion describes the effect of an email-domain auto-promotion rule. It carries the target org (where the user is moved) and whether the user should become a global admin (i.e. owner == conf.AdminOrg) on promotion.
In this IAM the global-admin status is computed from user.Owner == conf.AdminOrg. "global admin + home-org membership" is therefore expressed as Owner=AdminOrg for domains that should manage everything (hanzo, lux, zoo) and Owner=<homeOrg> + IsAdmin=true for org-scoped admins (pars).
func LookupDomainPromotion ¶ added in v1.18.1
func LookupDomainPromotion(email string) (DomainPromotion, bool)
LookupDomainPromotion returns the promotion outcome for an email's domain (case-insensitive), or (zero, false) if the domain is not configured.
Pure (modulo brand.json read): no DB access. Safe for unit tests.
Rule source: conf.LoadBrand() reads /etc/brand/brand.json (or $IAM_BRAND_FILE). White-label deployments override the rule list there — IAM itself ships no hardcoded brand-specific list.
type DynamicClientRegistrationRequest ¶
type DynamicClientRegistrationRequest struct {
ClientName string `json:"client_name,omitempty"`
RedirectUris []string `json:"redirect_uris,omitempty"`
GrantTypes []string `json:"grant_types,omitempty"`
ResponseTypes []string `json:"response_types,omitempty"`
TokenEndpointAuthMethod string `json:"token_endpoint_auth_method,omitempty"`
ApplicationType string `json:"application_type,omitempty"`
Contacts []string `json:"contacts,omitempty"`
LogoUri string `json:"logo_uri,omitempty"`
ClientUri string `json:"client_uri,omitempty"`
PolicyUri string `json:"policy_uri,omitempty"`
TosUri string `json:"tos_uri,omitempty"`
Scope string `json:"scope,omitempty"`
}
DynamicClientRegistrationRequest represents an RFC 7591 client registration request
type DynamicClientRegistrationResponse ¶
type DynamicClientRegistrationResponse struct {
ClientId string `json:"client_id"`
ClientSecret string `json:"client_secret,omitempty"`
ClientIdIssuedAt int64 `json:"client_id_issued_at,omitempty"`
ClientSecretExpiresAt int64 `json:"client_secret_expires_at,omitempty"`
ClientName string `json:"client_name,omitempty"`
RedirectUris []string `json:"redirect_uris,omitempty"`
GrantTypes []string `json:"grant_types,omitempty"`
ResponseTypes []string `json:"response_types,omitempty"`
TokenEndpointAuthMethod string `json:"token_endpoint_auth_method,omitempty"`
ApplicationType string `json:"application_type,omitempty"`
Contacts []string `json:"contacts,omitempty"`
LogoUri string `json:"logo_uri,omitempty"`
ClientUri string `json:"client_uri,omitempty"`
PolicyUri string `json:"policy_uri,omitempty"`
TosUri string `json:"tos_uri,omitempty"`
Scope string `json:"scope,omitempty"`
RegistrationClientUri string `json:"registration_client_uri,omitempty"`
RegistrationAccessToken string `json:"registration_access_token,omitempty"`
}
DynamicClientRegistrationResponse represents an RFC 7591 client registration response
type Enforcer ¶
type Enforcer struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100) updated" json:"updatedTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Description string `xorm:"varchar(100)" json:"description"`
Model string `xorm:"varchar(100)" json:"model"`
Adapter string `xorm:"varchar(100)" json:"adapter"`
ModelCfg map[string]string `xorm:"-" json:"modelCfg"`
*authz.Enforcer
}
func GetEnforcer ¶
func GetEnforcers ¶
func GetInitializedEnforcer ¶
func GetPaginationEnforcers ¶
func (*Enforcer) GetModelAndAdapter ¶
func (*Enforcer) InitEnforcer ¶
func (*Enforcer) LoadModelCfg ¶
type Expression ¶
type Filter ¶
type Filter struct {
Ptype string `json:"ptype,omitempty"`
FieldIndex *int `json:"fieldIndex,omitempty"`
FieldValues []string `json:"fieldValues"`
}
Filter represents filter criteria with optional policy type
type Form ¶
type Form struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Type string `xorm:"varchar(100)" json:"type"`
Tag string `xorm:"varchar(100)" json:"tag"`
FormItems []*FormItem `xorm:"mediumtext" json:"formItems"`
}
func GetGlobalForms ¶
func GetMaskedForm ¶
func GetMaskedForms ¶
func GetPaginationForms ¶
type GaugeVecInfo ¶
type Group ¶
type Group struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk unique index" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Manager string `xorm:"varchar(100)" json:"manager"`
ContactEmail string `xorm:"varchar(100)" json:"contactEmail"`
Type string `xorm:"varchar(100)" json:"type"`
ParentId string `xorm:"varchar(100)" json:"parentId"`
ParentName string `xorm:"-" json:"parentName"`
IsTopGroup bool `xorm:"bool" json:"isTopGroup"`
Users []string `xorm:"-" json:"users"`
Title string `json:"title,omitempty"`
Key string `json:"key,omitempty"`
HaveChildren bool `xorm:"-" json:"haveChildren"`
Children []*Group `json:"children,omitempty"`
IsEnabled bool `json:"isEnabled"`
}
func ConvertToTreeData ¶
func GetGlobalGroups ¶
func GetPaginationGroups ¶
type HistogramVecInfo ¶
type HttpProvider ¶
type HttpProvider struct {
// contains filtered or unexported fields
}
type IdpEntityDescriptor ¶
type IdpEntityDescriptor struct {
XMLName xml.Name `xml:"EntityDescriptor"`
DS string `xml:"xmlns:ds,attr"`
XMLNS string `xml:"xmlns,attr"`
MD string `xml:"xmlns:md,attr"`
EntityId string `xml:"entityID,attr"`
IdpSSODescriptor IdpSSODescriptor `xml:"IDPSSODescriptor"`
}
IdpEntityDescriptor SAML METADATA
func GetSamlMeta ¶
func GetSamlMeta(application *Application, host string, enablePostBinding bool) (*IdpEntityDescriptor, error)
type IdpSSODescriptor ¶
type IdpSSODescriptor struct {
XMLName xml.Name `xml:"urn:oasis:names:tc:SAML:2.0:metadata IDPSSODescriptor"`
ProtocolSupportEnumeration string `xml:"protocolSupportEnumeration,attr"`
SigningKeyDescriptor KeyDescriptor
NameIDFormats []NameIDFormat `xml:"NameIDFormat"`
SingleSignOnService SingleSignOnService `xml:"SingleSignOnService"`
Attribute []Attribute `xml:"Attribute"`
}
type InitData ¶
type InitData struct {
Organizations []*Organization `json:"organizations"`
Applications []*Application `json:"applications"`
Users []*User `json:"users"`
Certs []*Cert `json:"certs"`
Providers []*Provider `json:"providers"`
Ldaps []*Ldap `json:"ldaps"`
Models []*Model `json:"models"`
Permissions []*Permission `json:"permissions"`
Resources []*Resource `json:"resources"`
Roles []*Role `json:"roles"`
Syncers []*Syncer `json:"syncers"`
Tokens []*Token `json:"tokens"`
Webhooks []*Webhook `json:"webhooks"`
Groups []*Group `json:"groups"`
Adapters []*Adapter `json:"adapters"`
Enforcers []*Enforcer `json:"enforcers"`
Invitations []*Invitation `json:"invitations"`
Records []*Record `json:"records"`
Sessions []*Session `json:"sessions"`
Sites []*Site `json:"sites"`
Rules []*Rule `json:"rules"`
EnforcerPolicies map[string][][]string `json:"enforcerPolicies"`
}
type IntrospectionResponse ¶
type IntrospectionResponse struct {
Active bool `json:"active"`
Scope string `json:"scope,omitempty"`
ClientId string `json:"client_id,omitempty"`
Username string `json:"username,omitempty"`
TokenType string `json:"token_type,omitempty"`
Exp int64 `json:"exp,omitempty"`
Iat int64 `json:"iat,omitempty"`
Nbf int64 `json:"nbf,omitempty"`
Sub string `json:"sub,omitempty"`
Aud []string `json:"aud,omitempty"`
Iss string `json:"iss,omitempty"`
Jti string `json:"jti,omitempty"`
}
type Invitation ¶
type Invitation struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Code string `xorm:"varchar(100) index" json:"code"`
IsRegexp bool `json:"isRegexp"`
Quota int `json:"quota"`
UsedCount int `json:"usedCount"`
Application string `xorm:"varchar(100)" json:"application"`
Username string `xorm:"varchar(100)" json:"username"`
Email string `xorm:"varchar(100)" json:"email"`
Phone string `xorm:"varchar(100)" json:"phone"`
SignupGroup string `xorm:"varchar(100)" json:"signupGroup"`
DefaultCode string `xorm:"varchar(100)" json:"defaultCode"`
State string `xorm:"varchar(100)" json:"state"`
}
func CheckInvitationCode ¶
func CheckInvitationCode(application *Application, organization *Organization, authForm *form.AuthForm, lang string) (*Invitation, string)
func GetInvitation ¶
func GetInvitation(id string) (*Invitation, error)
func GetInvitationByCode ¶
func GetInvitationByCode(code string, organizationName string, lang string) (*Invitation, string)
func GetInvitations ¶
func GetInvitations(owner string) ([]*Invitation, error)
func GetMaskedInvitation ¶
func GetMaskedInvitation(invitation *Invitation) *Invitation
func GetPaginationInvitations ¶
func GetPaginationInvitations(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Invitation, error)
func (*Invitation) GetId ¶
func (invitation *Invitation) GetId() string
func (*Invitation) GetInvitationLink ¶
func (invitation *Invitation) GetInvitationLink(host string, application string) string
func (*Invitation) IsInvitationCodeValid ¶
func (invitation *Invitation) IsInvitationCodeValid(application *Application, invitationCode string, username string, email string, phone string, lang string) (bool, string)
func (*Invitation) SimpleCheckInvitationCode ¶
func (invitation *Invitation) SimpleCheckInvitationCode(invitationCode string, lang string) (bool, string)
type JsonWebKeySet ¶
type JsonWebKeySet struct {
Keys []interface{} `json:"keys"`
}
JsonWebKeySet is a JWKS container that supports both traditional (RSA/EC) and post-quantum (ML-DSA-65) keys. Traditional keys use go-jose serialization; ML-DSA-65 keys use the IETF draft format (kty=MLDSA, alg=MLDSA65).
func GetJsonWebKeySet ¶
func GetJsonWebKeySet(applicationName string) (JsonWebKeySet, error)
type Key ¶
type Key struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
// Type indicates the scope this key belongs to: "Organization", "Application", "User", or "General"
Type string `xorm:"varchar(100)" json:"type"`
Organization string `xorm:"varchar(100)" json:"organization"`
Application string `xorm:"varchar(100)" json:"application"`
User string `xorm:"varchar(100)" json:"user"`
AccessKey string `xorm:"varchar(100) index" json:"accessKey"`
AccessSecret string `xorm:"varchar(100)" json:"accessSecret"`
ExpireTime string `xorm:"varchar(100)" json:"expireTime"`
State string `xorm:"varchar(100)" json:"state"`
}
func GetGlobalKeys ¶
func GetKeyByAccessKey ¶
GetKeyByAccessKey resolves a key by its AccessKey (pk-) field. For sk- prefixed tokens, use GetKeyBySecretKey instead.
func GetKeyBySecretKey ¶
GetKeyBySecretKey resolves a key by its AccessSecret (sk-) field. Used when a backend sends a secret key for full API access.
func GetMaskedKey ¶
func GetPaginationGlobalKeys ¶
func GetPaginationKeys ¶
func ResolveAnyKey ¶
ResolveAnyKey resolves a token that could be pk-, sk-, or legacy (hk-/bare UUID). Returns the Key and whether it's a publishable key.
type KeyDescriptor ¶
type KeycloakSyncerProvider ¶
type KeycloakSyncerProvider struct {
DatabaseSyncerProvider
}
KeycloakSyncerProvider implements SyncerProvider for Keycloak database syncers Keycloak syncer extends DatabaseSyncerProvider with special handling for Keycloak schema
func (*KeycloakSyncerProvider) GetOriginalGroups ¶
func (p *KeycloakSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups from Keycloak (not implemented yet)
func (*KeycloakSyncerProvider) GetOriginalUserGroups ¶
func (p *KeycloakSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group IDs that a user belongs to (not implemented yet)
func (*KeycloakSyncerProvider) GetOriginalUsers ¶
func (p *KeycloakSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from Keycloak database This method overrides the base implementation to handle Keycloak-specific logic
type LarkAccessTokenResp ¶
type LarkAvatar ¶
type LarkDeptListResp ¶
type LarkStatus ¶
type LarkSyncerProvider ¶
type LarkSyncerProvider struct {
Syncer *Syncer
}
LarkSyncerProvider implements SyncerProvider for Lark API-based syncers
func (*LarkSyncerProvider) AddUser ¶
func (p *LarkSyncerProvider) AddUser(user *OriginalUser) (bool, error)
AddUser adds a new user to Lark (not supported for read-only API)
func (*LarkSyncerProvider) Close ¶
func (p *LarkSyncerProvider) Close() error
Close closes any open connections (no-op for Lark API-based syncer)
func (*LarkSyncerProvider) GetOriginalGroups ¶
func (p *LarkSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups from Lark (not implemented yet)
func (*LarkSyncerProvider) GetOriginalUserGroups ¶
func (p *LarkSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group IDs that a user belongs to (not implemented yet)
func (*LarkSyncerProvider) GetOriginalUsers ¶
func (p *LarkSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from Lark API
func (*LarkSyncerProvider) InitAdapter ¶
func (p *LarkSyncerProvider) InitAdapter() error
InitAdapter initializes the Lark syncer (no database adapter needed)
func (*LarkSyncerProvider) TestConnection ¶
func (p *LarkSyncerProvider) TestConnection() error
TestConnection tests the Lark API connection
func (*LarkSyncerProvider) UpdateUser ¶
func (p *LarkSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
UpdateUser updates an existing user in Lark (not supported for read-only API)
type LarkUser ¶
type LarkUser struct {
UserId string `json:"user_id"`
UnionId string `json:"union_id"`
OpenId string `json:"open_id"`
Name string `json:"name"`
EnName string `json:"en_name"`
Email string `json:"email"`
Mobile string `json:"mobile"`
Gender int `json:"gender"`
Avatar *LarkAvatar `json:"avatar"`
Status *LarkStatus `json:"status"`
DepartmentIds []string `json:"department_ids"`
JobTitle string `json:"job_title"`
}
type LarkUserListResp ¶
type Ldap ¶
type Ldap struct {
Id string `xorm:"varchar(100) notnull pk" json:"id"`
Owner string `xorm:"varchar(100)" json:"owner"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
ServerName string `xorm:"varchar(100)" json:"serverName"`
Host string `xorm:"varchar(100)" json:"host"`
Port int `xorm:"int" json:"port"`
EnableSsl bool `xorm:"bool" json:"enableSsl"`
AllowSelfSignedCert bool `xorm:"bool" json:"allowSelfSignedCert"`
Username string `xorm:"varchar(100)" json:"username"`
Password string `xorm:"varchar(100)" json:"password"`
BaseDn string `xorm:"varchar(500)" json:"baseDn"`
Filter string `xorm:"varchar(200)" json:"filter"`
FilterFields []string `xorm:"mediumtext" json:"filterFields"`
DefaultGroup string `xorm:"varchar(100)" json:"defaultGroup"`
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
CustomAttributes map[string]string `json:"customAttributes"`
AutoSync int `json:"autoSync"`
LastSync string `xorm:"varchar(100)" json:"lastSync"`
EnableGroups bool `xorm:"bool" json:"enableGroups"`
}
func (*Ldap) GetLdapConn ¶
type LdapAutoSynchronizer ¶
func GetLdapAutoSynchronizer ¶
func GetLdapAutoSynchronizer() *LdapAutoSynchronizer
func NewLdapAutoSynchronizer ¶
func NewLdapAutoSynchronizer() *LdapAutoSynchronizer
func (*LdapAutoSynchronizer) LdapAutoSynchronizerStartUpAll ¶
func (l *LdapAutoSynchronizer) LdapAutoSynchronizerStartUpAll() error
LdapAutoSynchronizerStartUpAll start all autosync goroutine for existing ldap servers in each organizations
func (*LdapAutoSynchronizer) StartAutoSync ¶
func (l *LdapAutoSynchronizer) StartAutoSync(ldapId string) error
StartAutoSync start autosync for specified ldap, old existing autosync goroutine will be ceased
func (*LdapAutoSynchronizer) StopAutoSync ¶
func (l *LdapAutoSynchronizer) StopAutoSync(ldapId string)
type LdapConn ¶
func (*LdapConn) GetLdapGroups ¶
GetLdapGroups fetches LDAP groups and organizational units
type LdapUser ¶
type LdapUser struct {
UidNumber string `json:"uidNumber"`
Uid string `json:"uid"`
Cn string `json:"cn"`
GidNumber string `json:"gidNumber"`
// Gcn string
Uuid string `json:"uuid"`
UserPrincipalName string `json:"userPrincipalName"`
DisplayName string `json:"displayName"`
Mail string
Email string `json:"email"`
EmailAddress string
TelephoneNumber string
Mobile string `json:"mobile"`
MobileTelephoneNumber string
RegisteredAddress string
PostalAddress string
Country string `json:"country"`
CountryName string `json:"countryName"`
GroupId string `json:"groupId"`
Address string `json:"address"`
MemberOf []string `json:"memberOf"`
Attributes map[string]string `json:"attributes"`
}
func AutoAdjustLdapUser ¶
func (*LdapUser) GetLdapUuid ¶
type MLDSA65WebKey ¶
type MLDSA65WebKey struct {
Kty string `json:"kty"`
Alg string `json:"alg"`
Use string `json:"use"`
Kid string `json:"kid"`
X string `json:"x"` // base64url-encoded raw public key
}
MLDSA65WebKey is the JWK representation of an ML-DSA-65 public key, following the IETF draft convention for post-quantum JWK.
type ManagedAccount ¶
type MfaAccount ¶
type MfaInterface ¶
type MfaInterface interface {
Initiate(userId string, issuer string) (*MfaProps, error)
SetupVerify(passcode string) error
Enable(user *User) error
Verify(passcode string) error
}
func GetMfaUtil ¶
func GetMfaUtil(mfaType string, config *MfaProps) MfaInterface
type MfaProps ¶
type MfaProps struct {
Enabled bool `json:"enabled"`
IsPreferred bool `json:"isPreferred"`
MfaType string `json:"mfaType" form:"mfaType"`
Secret string `json:"secret,omitempty"`
CountryCode string `json:"countryCode,omitempty"`
URL string `json:"url,omitempty"`
RecoveryCodes []string `json:"recoveryCodes,omitempty"`
MfaRememberInHours int `json:"mfaRememberInHours"`
}
func GetAllMfaProps ¶
type MigrationTarget ¶ added in v1.20.3
type MigrationTarget struct {
// Global is the enveloped global iam.db engine ({dataDir}/iam.db, principal
// "global"). All non-User tables go here.
Global *xorm.Engine
// Mgr owns the per-org enveloped user dbs ({dataDir}/orgs/<slug>/iam.db).
Mgr *OrgDBManager
// contains filtered or unexported fields
}
MigrationTarget is the destination of a Postgres→SQLite migration: the ENVELOPED on-disk layout the running IAM actually opens. It is built from the SAME primitives the runtime uses (openEncrypted for the global db, OrgDBManager for per-org user dbs), so the migrated files are byte-for-byte the shape the daemon expects — no separate "staging" format that the runtime would then refuse to open.
Routing mirrors the runtime exactly: only the User table is per-org (see orgEngine, called only from user.go); every other table lives on the global engine. So a migrator copies User rows into OrgEngine(owner) and all other tables into Global.
func NewMigrationTarget ¶ added in v1.20.3
func NewMigrationTarget(dataDir string) (*MigrationTarget, error)
NewMigrationTarget opens (creating) the enveloped destination layout under dataDir. It REQUIRES IAM_KMS_MASTER_KEY to be set and the build to be able to encrypt (CGO + libsqlcipher); otherwise it fails closed rather than writing a plaintext layout the runtime could never safely consume. The global engine has the full global schema synced; per-org user schemas are synced lazily by the manager on first OrgEngine(owner).
func (*MigrationTarget) Close ¶ added in v1.20.3
func (t *MigrationTarget) Close()
Close releases the global engine and all per-org engines.
func (*MigrationTarget) OrgEngine ¶ added in v1.20.3
func (t *MigrationTarget) OrgEngine(owner string) (*xorm.Engine, error)
OrgEngine returns the enveloped per-org engine for owner (creating + syncing it on first use), the destination for that org's User rows. Same routing the runtime uses via orgEngine(owner).
type Model ¶
type Model struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Description string `xorm:"varchar(100)" json:"description"`
ModelText string `xorm:"mediumtext" json:"modelText"`
authzmodel.Model `xorm:"-" json:"-"`
}
func GetPaginationModels ¶
type NameIDFormat ¶
type NameIDFormat struct {
// XMLName xml.Name
Value string `xml:",innerxml"`
}
type NotifySendInput ¶ added in v1.18.7
type NotifySendInput struct {
// Channel is "sms" or "email" — matches hanzoai/notify/pkg/types.Channel.
Channel string
// Recipient is the E.164 phone number for SMS or the email address
// for email. Notifyd fans out per recipient; IAM always sends one.
Recipient string
// OTP is the 6-digit code generated by getVerificationCode.
OTP string
// AppName is the IAM application name (e.g. "hanzo-console").
// Surfaces in the template as `{{.app}}` for branding.
AppName string
// Tenant is the IAM organization owning this OTP. Notifyd uses it
// as the X-Org-Id scope for provider + template resolution. Empty
// → defaults to the env tenant.
Tenant string
// IdempotencyKey, when set, dedupes notify sends for retries on the
// same OTP. SHA256(phone || code || time-bucket) is a good source.
IdempotencyKey string
}
NotifySendInput is the IAM-side shape of one OTP send. It carries the rendered fields the notify template expects, plus enough context for the notify server to attach the right tenant/event.
type OIDCAddress ¶
type OauthProtectedResourceMetadata ¶
type OauthProtectedResourceMetadata struct {
Resource string `json:"resource"`
AuthorizationServers []string `json:"authorization_servers"`
BearerMethodsSupported []string `json:"bearer_methods_supported,omitempty"`
ScopesSupported []string `json:"scopes_supported,omitempty"`
ResourceSigningAlg []string `json:"resource_signing_alg_values_supported,omitempty"`
ResourceDocumentation string `json:"resource_documentation,omitempty"`
}
OauthProtectedResourceMetadata represents RFC 9728 OAuth 2.0 Protected Resource Metadata
func GetOauthProtectedResourceMetadata ¶
func GetOauthProtectedResourceMetadata(host string) OauthProtectedResourceMetadata
GetOauthProtectedResourceMetadata returns RFC 9728 Protected Resource Metadata for global discovery
func GetOauthProtectedResourceMetadataByApplication ¶
func GetOauthProtectedResourceMetadataByApplication(host string, applicationName string) OauthProtectedResourceMetadata
GetOauthProtectedResourceMetadataByApplication returns RFC 9728 Protected Resource Metadata for application-specific discovery
type OidcDiscovery ¶
type OidcDiscovery struct {
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint"`
TokenEndpoint string `json:"token_endpoint"`
UserinfoEndpoint string `json:"userinfo_endpoint"`
DeviceAuthorizationEndpoint string `json:"device_authorization_endpoint"`
RegistrationEndpoint string `json:"registration_endpoint,omitempty"`
JwksUri string `json:"jwks_uri"`
IntrospectionEndpoint string `json:"introspection_endpoint"`
RevocationEndpoint string `json:"revocation_endpoint"`
ResponseTypesSupported []string `json:"response_types_supported"`
ResponseModesSupported []string `json:"response_modes_supported"`
GrantTypesSupported []string `json:"grant_types_supported"`
SubjectTypesSupported []string `json:"subject_types_supported"`
IdTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported"`
ScopesSupported []string `json:"scopes_supported"`
TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
IntrospectionEndpointAuthMethodsSupported []string `json:"introspection_endpoint_auth_methods_supported"`
RevocationEndpointAuthMethodsSupported []string `json:"revocation_endpoint_auth_methods_supported"`
CodeChallengeMethodsSupported []string `json:"code_challenge_methods_supported"`
ClaimsSupported []string `json:"claims_supported"`
RequestParameterSupported bool `json:"request_parameter_supported"`
RequestObjectSigningAlgValuesSupported []string `json:"request_object_signing_alg_values_supported"`
EndSessionEndpoint string `json:"end_session_endpoint"`
}
func GetOidcDiscovery ¶
func GetOidcDiscovery(host string, applicationName string) OidcDiscovery
type OktaSyncerProvider ¶
type OktaSyncerProvider struct {
Syncer *Syncer
}
OktaSyncerProvider implements SyncerProvider for Okta API-based syncers
func (*OktaSyncerProvider) AddUser ¶
func (p *OktaSyncerProvider) AddUser(user *OriginalUser) (bool, error)
AddUser adds a new user to Okta (not supported for read-only API)
func (*OktaSyncerProvider) Close ¶
func (p *OktaSyncerProvider) Close() error
Close closes any open connections (no-op for Okta API-based syncer)
func (*OktaSyncerProvider) GetOriginalGroups ¶
func (p *OktaSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups from Okta (not implemented yet)
func (*OktaSyncerProvider) GetOriginalUserGroups ¶
func (p *OktaSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group IDs that a user belongs to (not implemented yet)
func (*OktaSyncerProvider) GetOriginalUsers ¶
func (p *OktaSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from Okta API
func (*OktaSyncerProvider) InitAdapter ¶
func (p *OktaSyncerProvider) InitAdapter() error
InitAdapter initializes the Okta syncer (no database adapter needed)
func (*OktaSyncerProvider) TestConnection ¶
func (p *OktaSyncerProvider) TestConnection() error
TestConnection tests the Okta API connection
func (*OktaSyncerProvider) UpdateUser ¶
func (p *OktaSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
UpdateUser updates an existing user in Okta (not supported for read-only API)
type OktaUser ¶
type OktaUser struct {
Id string `json:"id"`
Status string `json:"status"`
Created string `json:"created"`
Profile struct {
Login string `json:"login"`
Email string `json:"email"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
DisplayName string `json:"displayName"`
MobilePhone string `json:"mobilePhone"`
PrimaryPhone string `json:"primaryPhone"`
StreetAddress string `json:"streetAddress"`
City string `json:"city"`
State string `json:"state"`
ZipCode string `json:"zipCode"`
CountryCode string `json:"countryCode"`
PostalAddress string `json:"postalAddress"`
PreferredLanguage string `json:"preferredLanguage"`
Locale string `json:"locale"`
Timezone string `json:"timezone"`
Title string `json:"title"`
Department string `json:"department"`
Organization string `json:"organization"`
} `json:"profile"`
}
OktaUser represents a user from Okta API
type OrgDBManager ¶
type OrgDBManager struct {
// contains filtered or unexported fields
}
OrgDBManager manages per-org SQLite databases for IAM.
Directory layout:
{DataDir}/iam.db ← Global: certs (JWT signing keys),
providers, admin org/app/user catalog.
{DataDir}/iam.db.dek ← Wrapped DEK for the global db.
{DataDir}/orgs/{orgSlug}/iam.db ← Per-org: users, apps, providers, tokens.
{DataDir}/orgs/{orgSlug}/iam.db.dek ← Wrapped DEK for that org's db.
When orgIsolation is "none" (default), this manager is nil and all queries go through the global ormer.Engine as before.
ENCRYPTION AT REST (envelope model — rotation-safe):
When a 32-byte master key is configured (IAM_KMS_MASTER_KEY, 64 hex chars), each database has its OWN random DEK (SQLCipher page key), generated once at creation and wrapped (AES-256-GCM) under a KEK = HKDF(masterKey, "org:{slug}"). The wrapped DEK lives in the `<db>.dek` sidecar; the raw DEK is never written. Rotating the master key only rewraps the sidecar (see Rewrap) — the DEK is unchanged, so the encrypted pages are never rewritten and no file is bricked.
Directory isolation separates org data on disk; the per-org DEK ensures one org's file cannot be read with another org's key even if exfiltrated.
func NewOrgDBManager ¶
func NewOrgDBManager(dataDir string) (*OrgDBManager, error)
NewOrgDBManager creates a new per-org database manager.
Encryption posture is decided once, here, from IAM_KMS_MASTER_KEY:
- unset → unencrypted per-org files (dev / CGO-off CI).
- set + cgo build → per-org SQLCipher encryption (production).
- set + !cgo build → hard error (resolveMasterKey). We refuse to run: a master key was supplied but this binary cannot encrypt, and silently writing plaintext org databases would violate the security contract.
Directory permissions are 0700.
func (*OrgDBManager) DeleteOrg ¶
func (m *OrgDBManager) DeleteOrg(owner string) error
DeleteOrg removes an org's engine from the pool and deletes its directory.
func (*OrgDBManager) Encrypted ¶ added in v1.20.3
func (m *OrgDBManager) Encrypted() bool
Encrypted reports whether this manager encrypts org databases at rest.
func (*OrgDBManager) GetEngine ¶
func (m *OrgDBManager) GetEngine(owner string) (*xorm.Engine, error)
GetEngine returns the xorm engine for an org, creating it on demand. The caller passes the RAW org owner; canonicalization to a slug happens here, so no caller can route to the wrong file or be rejected for a "weird" name.
func (*OrgDBManager) ListOrgs ¶
func (m *OrgDBManager) ListOrgs() ([]string, error)
ListOrgs returns all provisioned org slugs by scanning the orgs directory.
func (*OrgDBManager) ProvisionOrg ¶
func (m *OrgDBManager) ProvisionOrg(owner string) error
ProvisionOrg creates the org directory, database, and syncs org-scoped tables.
func (*OrgDBManager) ReleasePools ¶
func (m *OrgDBManager) ReleasePools()
ReleasePools closes all org engines. Call on shutdown.
func (*OrgDBManager) Rewrap ¶ added in v1.20.3
func (m *OrgDBManager) Rewrap(oldMaster, newMaster []byte) error
Rewrap rotates the master key for every provisioned org database (and is the mechanism that makes KMS master-key rotation non-destructive). For each org sidecar it unwraps the DEK with the OLD master's KEK and rewraps it with the NEW master's KEK, replacing the sidecar atomically. The DEK — and therefore every encrypted page — is never touched, so rotation cannot brick a file.
Call with the CURRENTLY-configured master key as oldMaster and the incoming key as newMaster. On success the manager's in-memory master key is updated; callers should re-open engines (or restart) to pick up the new posture. Any per-file failure aborts BEFORE mutating that file, so a partial rotation never loses data (already-rewrapped files remain readable under newMaster; the rest remain readable under oldMaster — operators re-run with the appropriate pair).
type Organization ¶
type Organization struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
WebsiteUrl string `xorm:"varchar(100)" json:"websiteUrl"`
Logo string `xorm:"varchar(200)" json:"logo"`
LogoDark string `xorm:"varchar(200)" json:"logoDark"`
Favicon string `xorm:"varchar(200)" json:"favicon"`
HasPrivilegeConsent bool `xorm:"bool" json:"hasPrivilegeConsent"`
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
PasswordOptions []string `xorm:"mediumtext" json:"passwordOptions"`
PasswordObfuscatorType string `xorm:"varchar(100)" json:"passwordObfuscatorType"`
PasswordObfuscatorKey string `xorm:"varchar(100)" json:"passwordObfuscatorKey"`
PasswordExpireDays int `json:"passwordExpireDays"`
CountryCodes []string `xorm:"mediumtext" json:"countryCodes"`
DefaultAvatar string `xorm:"varchar(200)" json:"defaultAvatar"`
UsePermanentAvatar bool `xorm:"bool" json:"usePermanentAvatar"`
DefaultApplication string `xorm:"varchar(100)" json:"defaultApplication"`
UserTypes []string `xorm:"mediumtext" json:"userTypes"`
Tags []string `xorm:"mediumtext" json:"tags"`
Languages []string `xorm:"mediumtext" json:"languages"`
ThemeData *ThemeData `xorm:"json" json:"themeData"`
MasterPassword string `xorm:"varchar(200)" json:"masterPassword"`
DefaultPassword string `xorm:"varchar(200)" json:"defaultPassword"`
MasterVerificationCode string `xorm:"varchar(100)" json:"masterVerificationCode"`
IpWhitelist string `xorm:"varchar(200)" json:"ipWhitelist"`
InitScore int `json:"initScore"`
EnableSoftDeletion bool `json:"enableSoftDeletion"`
IsProfilePublic bool `json:"isProfilePublic"`
UseEmailAsUsername bool `json:"useEmailAsUsername"`
EnableTour bool `json:"enableTour"`
DisableSignin bool `json:"disableSignin"`
IpRestriction string `json:"ipRestriction"`
WidgetItems []string `xorm:"mediumtext" json:"widgetItems"`
MfaItems []*MfaItem `xorm:"mediumtext" json:"mfaItems"`
MfaRememberInHours int `json:"mfaRememberInHours"`
AccountMenu string `xorm:"varchar(20)" json:"accountMenu"`
AccountItems []*AccountItem `xorm:"mediumtext" json:"accountItems"`
// Per-org signin rate limiting. Overrides the application-level defaults.
// 0 = use the application setting (which defaults to 5 attempts / 15 min).
FailedSigninLimit int `json:"failedSigninLimit"`
FailedSigninFrozenTime int `json:"failedSigninFrozenTime"`
DcrPolicy string `xorm:"varchar(100)" json:"dcrPolicy"`
LdapAttributes []string `xorm:"mediumtext" json:"ldapAttributes"`
KerberosRealm string `xorm:"varchar(200)" json:"kerberosRealm"`
KerberosKdcHost string `xorm:"varchar(200)" json:"kerberosKdcHost"`
KerberosKeytab string `xorm:"mediumtext" json:"kerberosKeytab"`
KerberosServiceName string `xorm:"varchar(100)" json:"kerberosServiceName"`
// DEPRECATED: Balance is managed by Commerce (billing.hanzo.ai). Do not write to these fields.
OrgBalance float64 `json:"orgBalance"`
UserBalance float64 `json:"userBalance"`
BalanceCredit float64 `json:"balanceCredit"`
BalanceCurrency string `xorm:"varchar(100)" json:"balanceCurrency"`
IsPersonal bool `xorm:"bool" json:"isPersonal"`
}
func CreatePersonalOrganization ¶
func CreatePersonalOrganization(username, displayName string) (*Organization, error)
CreatePersonalOrganization creates a personal organization and default application for a new user. Uses a database transaction for atomicity — if either insert fails, both are rolled back.
func GetMaskedOrganization ¶
func GetMaskedOrganization(organization *Organization, errs ...error) (*Organization, error)
func GetMaskedOrganizations ¶
func GetMaskedOrganizations(organizations []*Organization, errs ...error) ([]*Organization, error)
func GetOrganization ¶
func GetOrganization(id string) (*Organization, error)
func GetOrganizationByUser ¶
func GetOrganizationByUser(user *User) (*Organization, error)
func GetOrganizations ¶
func GetOrganizations(owner string, name ...string) ([]*Organization, error)
func GetOrganizationsByFields ¶
func GetOrganizationsByFields(owner string, fields ...string) ([]*Organization, error)
func NewAdminOrg ¶ added in v1.14.21
func NewAdminOrg() *Organization
NewAdminOrg returns the admin organization placeholder (owner=name=admin).
func NewOrg ¶ added in v1.14.21
func NewOrg(name string) *Organization
NewOrg returns an *Organization placeholder owned by the admin org with the given name. Useful for non-admin orgs that the admin user creates.
func (*Organization) GetInitScore ¶
func (org *Organization) GetInitScore() (int, error)
type OriginalGroup ¶
type OriginalGroup struct {
Id string
Name string
DisplayName string
Description string
Type string
Manager string
Email string
}
OriginalGroup represents a group from an external system
type OriginalUser ¶
type OriginalUser = User
type Ormer ¶
type Ormer struct {
Db *sql.DB
Engine *xorm.Engine
OrgDBManager *OrgDBManager // nil when orgIsolation != "sqlite"
// contains filtered or unexported fields
}
Ormer represents the MySQL adapter for policy storage.
func NewAdapter ¶
NewAdapter is the constructor for Ormer.
func NewAdapterFromDb ¶
func NewAdapterFromDb(driverName string, dataSourceName string, dbName string, db *sql.DB) (*Ormer, error)
NewAdapterFromDb is the constructor for Ormer.
func (*Ormer) CreateDatabase ¶
type PK ¶
type PK = []interface{}
PK is a composite primary key type. Composite primary key type for hanzoai/xorm compatibility.
type Permission ¶
type Permission struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Description string `xorm:"varchar(100)" json:"description"`
Users []string `xorm:"mediumtext" json:"users"`
Groups []string `xorm:"mediumtext" json:"groups"`
Roles []string `xorm:"mediumtext" json:"roles"`
Domains []string `xorm:"mediumtext" json:"domains"`
Model string `xorm:"varchar(100)" json:"model"`
Adapter string `xorm:"varchar(100)" json:"adapter"`
ResourceType string `xorm:"varchar(100)" json:"resourceType"`
Resources []string `xorm:"mediumtext" json:"resources"`
Actions []string `xorm:"mediumtext" json:"actions"`
Effect string `xorm:"varchar(100)" json:"effect"`
IsEnabled bool `json:"isEnabled"`
Submitter string `xorm:"varchar(100)" json:"submitter"`
Approver string `xorm:"varchar(100)" json:"approver"`
ApproveTime string `xorm:"varchar(100)" json:"approveTime"`
State string `xorm:"varchar(100)" json:"state"`
}
func GetMaskedPermissions ¶
func GetMaskedPermissions(permissions []*Permission) []*Permission
func GetPaginationPermissions ¶
func GetPaginationPermissions(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Permission, error)
func GetPermission ¶
func GetPermission(id string) (*Permission, error)
func GetPermissions ¶
func GetPermissions(owner string) ([]*Permission, error)
func GetPermissionsByModel ¶
func GetPermissionsByModel(owner string, model string) ([]*Permission, error)
func GetPermissionsByResource ¶
func GetPermissionsByResource(resourceId string) ([]*Permission, error)
func GetPermissionsByRole ¶
func GetPermissionsByRole(roleId string) ([]*Permission, error)
func GetPermissionsBySubmitter ¶
func GetPermissionsBySubmitter(owner string, submitter string) ([]*Permission, error)
func (*Permission) GetId ¶
func (p *Permission) GetId() string
func (*Permission) GetModelAndAdapter ¶
func (p *Permission) GetModelAndAdapter() string
type ProductInfo ¶
type ProductInfo struct {
Owner string `json:"owner"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Price float64 `json:"price"`
Quantity int `json:"quantity,omitempty"`
}
DEPRECATED: ProductInfo is retained for backward compatibility with the Cart column. Billing is now managed by Commerce (billing.hanzo.ai).
type Project ¶
type Project struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Description string `xorm:"varchar(500)" json:"description"`
Organization string `xorm:"varchar(100) index" json:"organization"`
Tags []string `xorm:"mediumtext" json:"tags"`
Metadata string `xorm:"mediumtext" json:"metadata"`
IsDefault bool `json:"isDefault"`
}
Project represents a project within an organization. Organizations contain projects, which scope applications and usage tracking.
func GetOrganizationProjects ¶
func GetPaginationProjects ¶
func GetProject ¶
func GetProjects ¶
type PrometheusInfo ¶
type PrometheusInfo struct {
ApiThroughput []GaugeVecInfo `json:"apiThroughput"`
ApiLatency []HistogramVecInfo `json:"apiLatency"`
TotalThroughput float64 `json:"totalThroughput"`
}
func GetPrometheusInfo ¶
func GetPrometheusInfo() (*PrometheusInfo, error)
type Provider ¶
type Provider struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk unique" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Category string `xorm:"varchar(100)" json:"category"`
Type string `xorm:"varchar(100)" json:"type"`
SubType string `xorm:"varchar(100)" json:"subType"`
Method string `xorm:"varchar(100)" json:"method"`
ClientId string `xorm:"varchar(200)" json:"clientId"`
ClientSecret string `xorm:"varchar(3000)" json:"clientSecret"`
ClientId2 string `xorm:"varchar(100)" json:"clientId2"`
ClientSecret2 string `xorm:"varchar(500)" json:"clientSecret2"`
Cert string `xorm:"varchar(100)" json:"cert"`
CustomAuthUrl string `xorm:"varchar(200)" json:"customAuthUrl"`
CustomTokenUrl string `xorm:"varchar(200)" json:"customTokenUrl"`
CustomUserInfoUrl string `xorm:"varchar(200)" json:"customUserInfoUrl"`
CustomLogo string `xorm:"varchar(200)" json:"customLogo"`
Scopes string `xorm:"varchar(100)" json:"scopes"`
UserMapping map[string]string `xorm:"varchar(500)" json:"userMapping"`
HttpHeaders map[string]string `xorm:"varchar(500)" json:"httpHeaders"`
Host string `xorm:"varchar(100)" json:"host"`
Port int `json:"port"`
DisableSsl bool `json:"disableSsl"` // Deprecated: Use SslMode instead. If the provider type is WeChat, DisableSsl means EnableQRCode, if type is Google, it means sync phone number
SslMode string `xorm:"varchar(100)" json:"sslMode"` // "Auto" (empty means Auto), "Enable", "Disable"
Title string `xorm:"varchar(100)" json:"title"`
Content string `xorm:"varchar(2000)" json:"content"` // If provider type is WeChat, Content means QRCode string by Base64 encoding
Receiver string `xorm:"varchar(100)" json:"receiver"`
RegionId string `xorm:"varchar(100)" json:"regionId"`
SignName string `xorm:"varchar(100)" json:"signName"`
TemplateCode string `xorm:"varchar(100)" json:"templateCode"`
AppId string `xorm:"varchar(100)" json:"appId"`
Endpoint string `xorm:"varchar(1000)" json:"endpoint"`
IntranetEndpoint string `xorm:"varchar(100)" json:"intranetEndpoint"`
Domain string `xorm:"varchar(100)" json:"domain"`
Bucket string `xorm:"varchar(100)" json:"bucket"`
PathPrefix string `xorm:"varchar(100)" json:"pathPrefix"`
Metadata string `xorm:"mediumtext" json:"metadata"`
IdP string `xorm:"mediumtext" json:"idP"`
IssuerUrl string `xorm:"varchar(100)" json:"issuerUrl"`
EnableSignAuthnRequest bool `json:"enableSignAuthnRequest"`
EmailRegex string `xorm:"varchar(200)" json:"emailRegex"`
ProviderUrl string `xorm:"varchar(200)" json:"providerUrl"`
EnableProxy bool `json:"enableProxy"`
EnablePkce bool `json:"enablePkce"`
}
func GetGlobalProviders ¶
func GetMaskedProvider ¶
func GetMaskedProviders ¶
func GetPaginationProviders ¶
func GetProvider ¶
func GetProviders ¶
func GetProvidersByCategory ¶
func GetWechatMiniProgramProvider ¶
func GetWechatMiniProgramProvider(application *Application) *Provider
type ProviderItem ¶
type ProviderItem struct {
Owner string `json:"owner"`
Name string `json:"name"`
CanSignUp bool `json:"canSignUp"`
CanSignIn bool `json:"canSignIn"`
CanUnlink bool `json:"canUnlink"`
BindingRule *[]string `json:"bindingRule"`
CountryCodes []string `json:"countryCodes"`
Prompted bool `json:"prompted"`
SignupGroup string `json:"signupGroup"`
Rule string `json:"rule"`
Provider *Provider `json:"provider"`
}
func (*ProviderItem) IsProviderVisible ¶
func (pi *ProviderItem) IsProviderVisible() bool
type PushMfa ¶
type PushMfa struct {
*MfaProps
// contains filtered or unexported fields
}
func NewPushMfaUtil ¶
func (*PushMfa) SetupVerify ¶
type RadiusAccounting ¶
type RadiusAccounting struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime time.Time `json:"createdTime"`
Username string `xorm:"index" json:"username"`
ServiceType int64 `json:"serviceType"` // e.g. LoginUser (1)
NasId string `json:"nasId"` // String identifying the network access server originating the Access-Request.
NasIpAddr string `json:"nasIpAddr"` // e.g. "192.168.0.10"
NasPortId string `json:"nasPortId"` // Contains a text string which identifies the port of the NAS that is authenticating the user. e.g."eth.0"
NasPortType int64 `json:"nasPortType"` // Indicates the type of physical port the network access server is using to authenticate the user. e.g.Ethernet(15)
NasPort int64 `json:"nasPort"` // Indicates the physical port number of the network access server that is authenticating the user. e.g. 233
FramedIpAddr string `json:"framedIpAddr"` // Indicates the IP address to be configured for the user by sending the IP address of a user to the RADIUS server.
FramedIpNetmask string `json:"framedIpNetmask"` // Indicates the IP netmask to be configured for the user when the user is using a device on a network.
AcctSessionId string `xorm:"index" json:"acctSessionId"`
AcctSessionTime int64 `json:"acctSessionTime"` // Indicates how long (in seconds) the user has received service.
AcctInputTotal int64 `json:"acctInputTotal"`
AcctOutputTotal int64 `json:"acctOutputTotal"`
AcctInputPackets int64 `json:"acctInputPackets"` // Indicates how many packets have been received from the port over the course of this service being provided to a framed user.
AcctOutputPackets int64 `json:"acctOutputPackets"` // Indicates how many packets have been sent to the port in the course of delivering this service to a framed user.
AcctTerminateCause int64 `json:"acctTerminateCause"` // e.g. Lost-Carrier (2)
LastUpdate time.Time `json:"lastUpdate"`
AcctStartTime time.Time `xorm:"index" json:"acctStartTime"`
AcctStopTime time.Time `xorm:"index" json:"acctStopTime"`
}
func GetRadiusAccounting ¶
func GetRadiusAccounting(id string) (*RadiusAccounting, error)
func GetRadiusAccountingBySessionId ¶
func GetRadiusAccountingBySessionId(sessionId string) (*RadiusAccounting, error)
func (*RadiusAccounting) GetId ¶
func (ra *RadiusAccounting) GetId() string
type RadiusMfa ¶
type RadiusMfa struct {
*MfaProps
// contains filtered or unexported fields
}
func NewRadiusMfaUtil ¶
func (*RadiusMfa) SetupVerify ¶
type Record ¶
type Record struct {
Id int `xorm:"int notnull pk autoincr" json:"id"`
Owner string `xorm:"varchar(100) index" json:"owner"`
Name string `xorm:"varchar(100) index" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
Organization string `xorm:"varchar(100)" json:"organization"`
ClientIp string `xorm:"varchar(100)" json:"clientIp"`
User string `xorm:"varchar(100)" json:"user"`
Method string `xorm:"varchar(100)" json:"method"`
RequestUri string `xorm:"varchar(1000)" json:"requestUri"`
Action string `xorm:"varchar(1000)" json:"action"`
Language string `xorm:"varchar(100)" json:"language"`
Object string `xorm:"mediumtext" json:"object"`
Response string `xorm:"mediumtext" json:"response"`
StatusCode int `json:"statusCode"`
IsTriggered bool `json:"isTriggered"`
}
func CopyRecord ¶
func GetPaginationRecords ¶
func GetRecords ¶
func GetRecordsByField ¶
type Resource ¶
type Resource struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(180) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
User string `xorm:"varchar(100)" json:"user"`
Provider string `xorm:"varchar(100)" json:"provider"`
Application string `xorm:"varchar(100)" json:"application"`
Tag string `xorm:"varchar(100)" json:"tag"`
Parent string `xorm:"varchar(100)" json:"parent"`
FileName string `xorm:"varchar(255)" json:"fileName"`
FileType string `xorm:"varchar(100)" json:"fileType"`
FileFormat string `xorm:"varchar(100)" json:"fileFormat"`
FileSize int `json:"fileSize"`
Url string `xorm:"varchar(500)" json:"url"`
Description string `xorm:"varchar(255)" json:"description"`
}
func GetDirectResources ¶
func GetPaginationResources ¶
func GetResource ¶
type RevokedToken ¶
type RevokedToken struct {
Id int64 `xorm:"pk autoincr" json:"id"`
TokenHash string `xorm:"varchar(100) notnull unique index" json:"tokenHash"`
TokenType string `xorm:"varchar(20)" json:"tokenType"` // "access_token" or "refresh_token"
RevokedAt string `xorm:"varchar(100)" json:"revokedAt"`
RevokedBy string `xorm:"varchar(100)" json:"revokedBy"` // User who revoked the token
ClientId string `xorm:"varchar(100)" json:"clientId"`
ExpiresAt string `xorm:"varchar(100)" json:"expiresAt"` // Original token expiration for cleanup
Owner string `xorm:"varchar(100)" json:"owner"`
Application string `xorm:"varchar(100)" json:"application"`
}
RevokedToken represents a revoked OAuth2 token (RFC 7009). Tokens are stored by their hash for security.
func GetRevokedTokens ¶
func GetRevokedTokens(owner string, application string) ([]*RevokedToken, error)
GetRevokedTokens returns all revoked tokens for an application.
type Role ¶
type Role struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Description string `xorm:"varchar(100)" json:"description"`
Users []string `xorm:"mediumtext" json:"users"`
Groups []string `xorm:"mediumtext" json:"groups"`
Roles []string `xorm:"mediumtext" json:"roles"`
Domains []string `xorm:"mediumtext" json:"domains"`
IsEnabled bool `json:"isEnabled"`
}
func GetAncestorRoles ¶
GetAncestorRoles returns a list of roles that contain the given roleIds
func GetMaskedRoles ¶
func GetPaginationRoles ¶
type Rule ¶
type Rule struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100) notnull" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100) notnull" json:"updatedTime"`
Type string `xorm:"varchar(100) notnull" json:"type"`
Expressions []*Expression `xorm:"mediumtext" json:"expressions"`
Action string `xorm:"varchar(100) notnull" json:"action"`
StatusCode int `xorm:"int notnull" json:"statusCode"`
Reason string `xorm:"varchar(100) notnull" json:"reason"`
IsVerbose bool `xorm:"bool" json:"isVerbose"`
}
func GetGlobalRules ¶
func GetPaginationRules ¶
func GetRulesByRuleIds ¶
type SCIMAddress ¶
type SCIMAddress struct {
StreetAddress string `json:"streetAddress"`
Locality string `json:"locality"`
Region string `json:"region"`
PostalCode string `json:"postalCode"`
Country string `json:"country"`
Formatted string `json:"formatted"`
Type string `json:"type"`
Primary bool `json:"primary"`
}
SCIMAddress represents a SCIM user address structure
type SCIMEmail ¶
type SCIMEmail struct {
Value string `json:"value"`
Type string `json:"type"`
Primary bool `json:"primary"`
}
SCIMEmail represents a SCIM user email structure
type SCIMListResponse ¶
type SCIMListResponse struct {
TotalResults int `json:"totalResults"`
ItemsPerPage int `json:"itemsPerPage"`
StartIndex int `json:"startIndex"`
Resources []*SCIMUser `json:"Resources"`
}
SCIMListResponse represents a SCIM list response
type SCIMName ¶
type SCIMName struct {
FamilyName string `json:"familyName"`
GivenName string `json:"givenName"`
Formatted string `json:"formatted"`
}
SCIMName represents a SCIM user name structure
type SCIMPhoneNumber ¶
type SCIMPhoneNumber struct {
Value string `json:"value"`
Type string `json:"type"`
Primary bool `json:"primary"`
}
SCIMPhoneNumber represents a SCIM user phone number structure
type SCIMSyncerProvider ¶
type SCIMSyncerProvider struct {
Syncer *Syncer
}
SCIMSyncerProvider implements SyncerProvider for SCIM 2.0 API-based syncers
func (*SCIMSyncerProvider) AddUser ¶
func (p *SCIMSyncerProvider) AddUser(user *OriginalUser) (bool, error)
AddUser adds a new user to SCIM (not supported for read-only API)
func (*SCIMSyncerProvider) Close ¶
func (p *SCIMSyncerProvider) Close() error
Close closes any open connections (no-op for SCIM API-based syncer)
func (*SCIMSyncerProvider) GetOriginalGroups ¶
func (p *SCIMSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups from SCIM (not implemented yet)
func (*SCIMSyncerProvider) GetOriginalUserGroups ¶
func (p *SCIMSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group IDs that a user belongs to (not implemented yet)
func (*SCIMSyncerProvider) GetOriginalUsers ¶
func (p *SCIMSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from SCIM API
func (*SCIMSyncerProvider) InitAdapter ¶
func (p *SCIMSyncerProvider) InitAdapter() error
InitAdapter initializes the SCIM syncer (no database adapter needed)
func (*SCIMSyncerProvider) TestConnection ¶
func (p *SCIMSyncerProvider) TestConnection() error
TestConnection tests the SCIM API connection
func (*SCIMSyncerProvider) UpdateUser ¶
func (p *SCIMSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
UpdateUser updates an existing user in SCIM (not supported for read-only API)
type SCIMUser ¶
type SCIMUser struct {
ID string `json:"id"`
ExternalID string `json:"externalId"`
UserName string `json:"userName"`
Name SCIMName `json:"name"`
DisplayName string `json:"displayName"`
NickName string `json:"nickName"`
ProfileURL string `json:"profileUrl"`
Title string `json:"title"`
UserType string `json:"userType"`
PreferredLan string `json:"preferredLanguage"`
Locale string `json:"locale"`
Timezone string `json:"timezone"`
Active bool `json:"active"`
Emails []SCIMEmail `json:"emails"`
PhoneNumbers []SCIMPhoneNumber `json:"phoneNumbers"`
Addresses []SCIMAddress `json:"addresses"`
}
SCIMUser represents a SCIM 2.0 user resource
type SafeAdapter ¶
type SafeAdapter struct {
*authzstore.Adapter
// contains filtered or unexported fields
}
SafeAdapter wraps an authzstore.Adapter and overrides RemovePolicy / RemovePolicies with versions that force-include the zero-valued V columns in the WHERE clause via MustCols. The base adapter already does this for single-row deletes; SafeAdapter exists because the authz library's bulk remove path used to call RemovePolicies, which the original xorm-adapter did NOT MustCols, leading to over-broad deletes in production. We keep the override here for parity with historical behavior.
func NewSafeAdapter ¶
func NewSafeAdapter(a *Adapter) *SafeAdapter
func (*SafeAdapter) RemovePolicies ¶
func (a *SafeAdapter) RemovePolicies(sec string, ptype string, rules [][]string) error
func (*SafeAdapter) RemovePolicy ¶
func (a *SafeAdapter) RemovePolicy(sec string, ptype string, rule []string) error
type Saml11AssertionArtifact ¶
type Saml11Request ¶
type Saml11Request struct {
XMLName xml.Name `xml:"Request"`
SAMLP string `xml:"samlp,attr"`
MajorVersion string `xml:"MajorVersion,attr"`
MinorVersion string `xml:"MinorVersion,attr"`
RequestID string `xml:"RequestID,attr"`
IssueInstant string `xml:"IssueInstance,attr"`
AssertionArtifact Saml11AssertionArtifact
}
type ScopeDescription ¶
type ScopeDescription struct {
Scope string `json:"scope"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
}
ScopeDescription represents a human-readable description of an OAuth scope
type Server ¶
type Server struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Url string `xorm:"varchar(500)" json:"url"`
Token string `xorm:"varchar(500)" json:"-"`
Application string `xorm:"varchar(100)" json:"application"`
Tools []*Tool `xorm:"mediumtext" json:"tools"`
}
func GetPaginationServers ¶
func GetServers ¶
type Session ¶
type Session struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
Application string `xorm:"varchar(100) notnull pk" json:"application"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
SessionId []string `json:"sessionId"`
ExclusiveSignin bool `xorm:"-"`
}
func GetPaginationSessions ¶
func GetSessions ¶
func GetSingleSession ¶
func GetUserAppSessions ¶
type SigninItem ¶
type SigninMethod ¶
type SignupItem ¶
type SignupItem struct {
Name string `json:"name"`
Visible bool `json:"visible"`
Required bool `json:"required"`
Prompted bool `json:"prompted"`
Type string `json:"type"`
CustomCss string `json:"customCss"`
Label string `json:"label"`
Placeholder string `json:"placeholder"`
Options []string `json:"options"`
Regex string `json:"regex"`
Rule string `json:"rule"`
}
type SingleSignOnService ¶
type Site ¶
type Site struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Tag string `xorm:"varchar(100)" json:"tag"`
Domain string `xorm:"varchar(100)" json:"domain"`
OtherDomains []string `xorm:"varchar(500)" json:"otherDomains"`
NeedRedirect bool `json:"needRedirect"`
DisableVerbose bool `json:"disableVerbose"`
Rules []string `xorm:"varchar(500)" json:"rules"`
EnableAlert bool `json:"enableAlert"`
AlertInterval int `json:"alertInterval"`
AlertTryTimes int `json:"alertTryTimes"`
AlertProviders []string `xorm:"varchar(500)" json:"alertProviders"`
Challenges []string `xorm:"mediumtext" json:"challenges"`
Host string `xorm:"varchar(100)" json:"host"`
Port int `json:"port"`
Hosts []string `xorm:"varchar(1000)" json:"hosts"`
SslMode string `xorm:"varchar(100)" json:"sslMode"`
SslCert string `xorm:"-" json:"sslCert"`
PublicIp string `xorm:"varchar(100)" json:"publicIp"`
Node string `xorm:"varchar(100)" json:"node"`
IsSelf bool `json:"isSelf"`
Status string `xorm:"varchar(100)" json:"status"`
Nodes []*NodeItem `xorm:"mediumtext" json:"nodes"`
IamApplication string `xorm:"varchar(100)" json:"iamApplication"`
ApplicationObj *Application `xorm:"-" json:"applicationObj"`
}
func GetGlobalSites ¶
func GetMaskedSite ¶
func GetMaskedSites ¶
func GetPaginationSites ¶
func GetSiteByDomain ¶
func (*Site) GetChallengeMap ¶
type SmsMfa ¶
type SmsMfa struct {
*MfaProps
}
func NewEmailMfaUtil ¶
func NewSmsMfaUtil ¶
func (*SmsMfa) SetupVerify ¶
type SsoLogoutNotification ¶
type SsoLogoutNotification struct {
// User information
Owner string `json:"owner"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Email string `json:"email"`
Phone string `json:"phone"`
Id string `json:"id"`
// Event type
Event string `json:"event"`
// Session-level information for targeted logout
SessionIds []string `json:"sessionIds"` // List of session IDs being logged out
AccessTokenHashes []string `json:"accessTokenHashes"` // Hashes of access tokens being expired
// Authentication fields to prevent malicious logout requests
Nonce string `json:"nonce"` // Random nonce for replay protection
Timestamp int64 `json:"timestamp"` // Unix timestamp of the notification
Signature string `json:"signature"` // HMAC-SHA256 signature for verification
}
SsoLogoutNotification represents the structure of a session-level SSO logout notification This includes session information and a signature for authentication
type Syncer ¶
type Syncer struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
Organization string `xorm:"varchar(100)" json:"organization"`
Type string `xorm:"varchar(100)" json:"type"`
DatabaseType string `xorm:"varchar(100)" json:"databaseType"`
SslMode string `xorm:"varchar(100)" json:"sslMode"`
SshType string `xorm:"varchar(100)" json:"sshType"`
Host string `xorm:"varchar(100)" json:"host"`
Port int `json:"port"`
User string `xorm:"varchar(100)" json:"user"`
Password string `xorm:"varchar(150)" json:"password"`
SshHost string `xorm:"varchar(100)" json:"sshHost"`
SshPort int `json:"sshPort"`
SshUser string `xorm:"varchar(100)" json:"sshUser"`
SshPassword string `xorm:"varchar(150)" json:"sshPassword"`
Cert string `xorm:"varchar(100)" json:"cert"`
Database string `xorm:"varchar(100)" json:"database"`
Table string `xorm:"varchar(100)" json:"table"`
TableColumns []*TableColumn `xorm:"mediumtext" json:"tableColumns"`
AffiliationTable string `xorm:"varchar(100)" json:"affiliationTable"`
AvatarBaseUrl string `xorm:"varchar(100)" json:"avatarBaseUrl"`
ErrorText string `xorm:"mediumtext" json:"errorText"`
SyncInterval int `json:"syncInterval"`
IsReadOnly bool `json:"isReadOnly"`
IsEnabled bool `json:"isEnabled"`
Ormer *Ormer `xorm:"-" json:"-"`
SshClient *ssh.Client `xorm:"-" json:"-"`
}
func GetOrganizationSyncers ¶
func GetPaginationSyncers ¶
func GetSyncers ¶
type SyncerProvider ¶
type SyncerProvider interface {
// InitAdapter initializes the connection to the external system
InitAdapter() error
// GetOriginalUsers retrieves all users from the external system
GetOriginalUsers() ([]*OriginalUser, error)
// GetOriginalGroups retrieves all groups from the external system
GetOriginalGroups() ([]*OriginalGroup, error)
// GetOriginalUserGroups retrieves the group IDs that a user belongs to
GetOriginalUserGroups(userId string) ([]string, error)
// AddUser adds a new user to the external system
AddUser(user *OriginalUser) (bool, error)
// UpdateUser updates an existing user in the external system
UpdateUser(user *OriginalUser) (bool, error)
// TestConnection tests the connection to the external system
TestConnection() error
// Close closes any open connections and releases resources
Close() error
}
SyncerProvider defines the interface that all syncer implementations must satisfy. Different syncer types (Database, Keycloak, WeCom, Azure AD) implement this interface.
func GetSyncerProvider ¶
func GetSyncerProvider(syncer *Syncer) SyncerProvider
GetSyncerProvider returns the appropriate SyncerProvider implementation based on syncer type
type TableColumn ¶
type Ticket ¶
type Ticket struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
User string `xorm:"varchar(100) index" json:"user"`
Title string `xorm:"varchar(200)" json:"title"`
Content string `xorm:"mediumtext" json:"content"`
State string `xorm:"varchar(50)" json:"state"`
Messages []*TicketMessage `xorm:"mediumtext json" json:"messages"`
}
func GetPaginationTickets ¶
func GetTickets ¶
func GetUserTickets ¶
type TicketMessage ¶
type Token ¶
type Token struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
Application string `xorm:"varchar(100)" json:"application"`
Organization string `xorm:"varchar(100)" json:"organization"`
User string `xorm:"varchar(100)" json:"user"`
Code string `xorm:"varchar(100) index" json:"code"`
AccessToken string `xorm:"mediumtext" json:"accessToken"`
RefreshToken string `xorm:"mediumtext" json:"refreshToken"`
AccessTokenHash string `xorm:"varchar(100) index" json:"accessTokenHash"`
RefreshTokenHash string `xorm:"varchar(100) index" json:"refreshTokenHash"`
ExpiresIn int `json:"expiresIn"`
Scope string `xorm:"varchar(100)" json:"scope"`
TokenType string `xorm:"varchar(100)" json:"tokenType"`
CodeChallenge string `xorm:"varchar(100)" json:"codeChallenge"`
CodeChallengeMethod string `xorm:"varchar(10)" json:"codeChallengeMethod"`
CodeIsUsed bool `json:"codeIsUsed"`
CodeExpireIn int64 `json:"codeExpireIn"`
Resource string `xorm:"varchar(255)" json:"resource"` // RFC 8707 Resource Indicator
}
func GetPaginationTokens ¶
func GetTokenByAccessToken ¶
func GetTokenByRefreshToken ¶
func GetTokenByTokenValue ¶
func GetTokenByUser ¶
func GetTokenByUser(application *Application, user *User, scope string, nonce string, host string) (*Token, error)
GetTokenByUser Implicit flow
func GetTokensByUser ¶
GetTokensByUser retrieves all tokens for a specific user
func GetUserTokenForAudience ¶ added in v1.28.2
func GetUserTokenForAudience(application *Application, user *User, audience string, scope string, host string) (*Token, error)
GetUserTokenForAudience mints a short-lived, user-bound JWT for an EXPLICIT audience. It is the server-side primitive a confidential, trusted client (e.g. hanzo-console) uses to obtain a token it forwards to a resource server (e.g. commerce) that derives the user's org from the verified `owner` claim — the SSR analogue of a browser holding its own IAM token.
It is identical to GetTokenByUser except the audience is set explicitly via the RFC 8707 `resource` claim instead of defaulting to the minting application's clientId. This decouples the token's audience from WHICH app minted it, so the resource server's fixed audience allowlist (commerce IAM_ACCEPTED_AUDIENCES) matches deterministically. An empty `audience` falls back to the default (clientId / shared-org) audience, so callers that don't care get GetTokenByUser's behavior.
The token carries the user's real `owner` (org) claim, so the resource server scopes strictly to THAT org — there is no cross-tenant widening here: the audience only names the trusted client, never the billed subject.
type TokenError ¶
type TokenWrapper ¶
type TotpMfa ¶
type TotpMfa struct {
*MfaProps
// contains filtered or unexported fields
}
func NewTotpMfaUtil ¶
func (*TotpMfa) SetupVerify ¶
type User ¶
type User struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(255) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100) index" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
DeletedTime string `xorm:"varchar(100)" json:"deletedTime"`
Id string `xorm:"varchar(100) index" json:"id"`
ExternalId string `xorm:"varchar(100) index" json:"externalId"`
Type string `xorm:"varchar(100)" json:"type"`
Password string `xorm:"varchar(150)" json:"password"`
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
FirstName string `xorm:"varchar(100)" json:"firstName"`
LastName string `xorm:"varchar(100)" json:"lastName"`
Avatar string `xorm:"text" json:"avatar"`
AvatarType string `xorm:"varchar(100)" json:"avatarType"`
PermanentAvatar string `xorm:"varchar(500)" json:"permanentAvatar"`
Email string `xorm:"varchar(100) index" json:"email"`
EmailVerified bool `json:"emailVerified"`
Phone string `xorm:"varchar(100) index" json:"phone"`
CountryCode string `xorm:"varchar(6)" json:"countryCode"`
Region string `xorm:"varchar(100)" json:"region"`
Location string `xorm:"varchar(100)" json:"location"`
Address []string `json:"address"`
Addresses []*Address `xorm:"addresses blob" json:"addresses"`
Affiliation string `xorm:"varchar(100)" json:"affiliation"`
Title string `xorm:"varchar(100)" json:"title"`
IdCardType string `xorm:"varchar(100)" json:"idCardType"`
IdCard string `xorm:"varchar(100) index" json:"idCard"`
RealName string `xorm:"varchar(100)" json:"realName"`
IsVerified bool `json:"isVerified"`
Homepage string `xorm:"varchar(100)" json:"homepage"`
Bio string `xorm:"varchar(100)" json:"bio"`
Tag string `xorm:"varchar(100)" json:"tag"`
Language string `xorm:"varchar(100)" json:"language"`
Gender string `xorm:"varchar(100)" json:"gender"`
Birthday string `xorm:"varchar(100)" json:"birthday"`
Education string `xorm:"varchar(100)" json:"education"`
Score int `json:"score"`
Karma int `json:"karma"`
Ranking int `json:"ranking"`
// DEPRECATED: Balance is managed by Commerce (billing.hanzo.ai). Do not write to these fields.
Balance float64 `json:"balance"`
BalanceCredit float64 `json:"balanceCredit"`
Currency string `xorm:"varchar(100)" json:"currency"`
BalanceCurrency string `xorm:"varchar(100)" json:"balanceCurrency"`
IsDefaultAvatar bool `xorm:"bool default false" json:"isDefaultAvatar"`
IsOnline bool `xorm:"bool default false" json:"isOnline"`
IsAdmin bool `xorm:"bool default false" json:"isAdmin"`
IsForbidden bool `xorm:"bool default false" json:"isForbidden"`
IsDeleted bool `xorm:"bool default false" json:"isDeleted"`
SignupApplication string `xorm:"varchar(100)" json:"signupApplication"`
Hash string `xorm:"varchar(100)" json:"hash"`
PreHash string `xorm:"varchar(100)" json:"preHash"`
RegisterType string `xorm:"varchar(100)" json:"registerType"`
RegisterSource string `xorm:"varchar(100)" json:"registerSource"`
AccessKey string `xorm:"varchar(100)" json:"accessKey"`
AccessSecret string `xorm:"varchar(100)" json:"accessSecret"`
AccessToken string `xorm:"mediumtext" json:"accessToken"`
OriginalToken string `xorm:"mediumtext" json:"originalToken"`
OriginalRefreshToken string `xorm:"mediumtext" json:"originalRefreshToken"`
CreatedIp string `xorm:"varchar(100)" json:"createdIp"`
LastSigninTime string `xorm:"varchar(100)" json:"lastSigninTime"`
LastSigninIp string `xorm:"varchar(100)" json:"lastSigninIp"`
GitHub string `xorm:"github varchar(100)" json:"github"`
Google string `xorm:"varchar(100)" json:"google"`
QQ string `xorm:"qq varchar(100)" json:"qq"`
WeChat string `xorm:"wechat varchar(100)" json:"wechat"`
Facebook string `xorm:"facebook varchar(100)" json:"facebook"`
DingTalk string `xorm:"dingtalk varchar(100)" json:"dingtalk"`
Weibo string `xorm:"weibo varchar(100)" json:"weibo"`
Gitee string `xorm:"gitee varchar(100)" json:"gitee"`
LinkedIn string `xorm:"linkedin varchar(100)" json:"linkedin"`
Wecom string `xorm:"wecom varchar(100)" json:"wecom"`
Lark string `xorm:"lark varchar(100)" json:"lark"`
Gitlab string `xorm:"gitlab varchar(100)" json:"gitlab"`
Adfs string `xorm:"adfs varchar(100)" json:"adfs"`
Baidu string `xorm:"baidu varchar(100)" json:"baidu"`
Alipay string `xorm:"alipay varchar(100)" json:"alipay"`
Iam string `xorm:"iam varchar(100)" json:"iam"`
Infoflow string `xorm:"infoflow varchar(100)" json:"infoflow"`
Apple string `xorm:"apple varchar(100)" json:"apple"`
AzureAD string `xorm:"azuread varchar(100)" json:"azuread"`
AzureADB2c string `xorm:"azureadb2c varchar(100)" json:"azureadb2c"`
Slack string `xorm:"slack varchar(100)" json:"slack"`
Steam string `xorm:"steam varchar(100)" json:"steam"`
Bilibili string `xorm:"bilibili varchar(100)" json:"bilibili"`
Okta string `xorm:"okta varchar(100)" json:"okta"`
Douyin string `xorm:"douyin varchar(100)" json:"douyin"`
Kwai string `xorm:"kwai varchar(100)" json:"kwai"`
Line string `xorm:"line varchar(100)" json:"line"`
Amazon string `xorm:"amazon varchar(100)" json:"amazon"`
Auth0 string `xorm:"auth0 varchar(100)" json:"auth0"`
BattleNet string `xorm:"battlenet varchar(100)" json:"battlenet"`
Bitbucket string `xorm:"bitbucket varchar(100)" json:"bitbucket"`
Box string `xorm:"box varchar(100)" json:"box"`
CloudFoundry string `xorm:"cloudfoundry varchar(100)" json:"cloudfoundry"`
Dailymotion string `xorm:"dailymotion varchar(100)" json:"dailymotion"`
Deezer string `xorm:"deezer varchar(100)" json:"deezer"`
DigitalOcean string `xorm:"digitalocean varchar(100)" json:"digitalocean"`
Discord string `xorm:"discord varchar(100)" json:"discord"`
Dropbox string `xorm:"dropbox varchar(100)" json:"dropbox"`
EveOnline string `xorm:"eveonline varchar(100)" json:"eveonline"`
Fitbit string `xorm:"fitbit varchar(100)" json:"fitbit"`
Gitea string `xorm:"gitea varchar(100)" json:"gitea"`
Heroku string `xorm:"heroku varchar(100)" json:"heroku"`
InfluxCloud string `xorm:"influxcloud varchar(100)" json:"influxcloud"`
Instagram string `xorm:"instagram varchar(100)" json:"instagram"`
Intercom string `xorm:"intercom varchar(100)" json:"intercom"`
Kakao string `xorm:"kakao varchar(100)" json:"kakao"`
Lastfm string `xorm:"lastfm varchar(100)" json:"lastfm"`
Mailru string `xorm:"mailru varchar(100)" json:"mailru"`
Meetup string `xorm:"meetup varchar(100)" json:"meetup"`
MicrosoftOnline string `xorm:"microsoftonline varchar(100)" json:"microsoftonline"`
Nextcloud string `xorm:"nextcloud varchar(100)" json:"nextcloud"`
OneDrive string `xorm:"onedrive varchar(100)" json:"onedrive"`
Oura string `xorm:"oura varchar(100)" json:"oura"`
Patreon string `xorm:"patreon varchar(100)" json:"patreon"`
Paypal string `xorm:"paypal varchar(100)" json:"paypal"`
SalesForce string `xorm:"salesforce varchar(100)" json:"salesforce"`
Shopify string `xorm:"shopify varchar(100)" json:"shopify"`
Soundcloud string `xorm:"soundcloud varchar(100)" json:"soundcloud"`
Spotify string `xorm:"spotify varchar(100)" json:"spotify"`
Strava string `xorm:"strava varchar(100)" json:"strava"`
Stripe string `xorm:"stripe varchar(100)" json:"stripe"`
Telegram string `xorm:"telegram varchar(100)" json:"telegram"`
TikTok string `xorm:"tiktok varchar(100)" json:"tiktok"`
Tumblr string `xorm:"tumblr varchar(100)" json:"tumblr"`
Twitch string `xorm:"twitch varchar(100)" json:"twitch"`
Twitter string `xorm:"twitter varchar(100)" json:"twitter"`
Typetalk string `xorm:"typetalk varchar(100)" json:"typetalk"`
Uber string `xorm:"uber varchar(100)" json:"uber"`
VK string `xorm:"vk varchar(100)" json:"vk"`
Wepay string `xorm:"wepay varchar(100)" json:"wepay"`
Xero string `xorm:"xero varchar(100)" json:"xero"`
Yahoo string `xorm:"yahoo varchar(100)" json:"yahoo"`
Yammer string `xorm:"yammer varchar(100)" json:"yammer"`
Yandex string `xorm:"yandex varchar(100)" json:"yandex"`
Zoom string `xorm:"zoom varchar(100)" json:"zoom"`
Custom string `xorm:"custom varchar(100)" json:"custom"`
Custom2 string `xorm:"custom2 text" json:"custom2"`
Custom3 string `xorm:"custom3 text" json:"custom3"`
Custom4 string `xorm:"custom4 text" json:"custom4"`
Custom5 string `xorm:"custom5 text" json:"custom5"`
Custom6 string `xorm:"custom6 text" json:"custom6"`
Custom7 string `xorm:"custom7 text" json:"custom7"`
Custom8 string `xorm:"custom8 text" json:"custom8"`
Custom9 string `xorm:"custom9 text" json:"custom9"`
Custom10 string `xorm:"custom10 text" json:"custom10"`
WebauthnCredentials []webauthn.Credential `xorm:"webauthnCredentials blob" json:"webauthnCredentials"`
PreferredMfaType string `xorm:"varchar(100)" json:"preferredMfaType"`
RecoveryCodes []string `xorm:"mediumtext" json:"recoveryCodes"`
TotpSecret string `xorm:"varchar(100)" json:"totpSecret"`
VerificationCode string `xorm:"varchar(20)" json:"verificationCode"` // Per-user pinned OTP (test/sandbox users)
MfaPhoneEnabled bool `json:"mfaPhoneEnabled"`
MfaEmailEnabled bool `json:"mfaEmailEnabled"`
MfaRadiusEnabled bool `json:"mfaRadiusEnabled"`
MfaRadiusUsername string `xorm:"varchar(100)" json:"mfaRadiusUsername"`
MfaRadiusProvider string `xorm:"varchar(100)" json:"mfaRadiusProvider"`
MfaPushEnabled bool `json:"mfaPushEnabled"`
MfaPushReceiver string `xorm:"varchar(100)" json:"mfaPushReceiver"`
MfaPushProvider string `xorm:"varchar(100)" json:"mfaPushProvider"`
MultiFactorAuths []*MfaProps `xorm:"-" json:"multiFactorAuths,omitempty"`
Invitation string `xorm:"varchar(100) index" json:"invitation"`
InvitationCode string `xorm:"varchar(100) index" json:"invitationCode"`
FaceIds []*FaceId `json:"faceIds"`
Cart []ProductInfo `xorm:"mediumtext" json:"cart"`
Ldap string `xorm:"ldap varchar(100)" json:"ldap"`
Properties map[string]string `json:"properties"`
Roles []*Role `json:"roles"`
Permissions []*Permission `json:"permissions"`
Groups []string `xorm:"mediumtext" json:"groups"`
LastChangePasswordTime string `xorm:"varchar(100)" json:"lastChangePasswordTime"`
LastSigninWrongTime string `xorm:"varchar(100)" json:"lastSigninWrongTime"`
SigninWrongTimes int `json:"signinWrongTimes"`
ManagedAccounts []ManagedAccount `xorm:"managedAccounts blob" json:"managedAccounts"`
MfaAccounts []MfaAccount `xorm:"mfaAccounts blob" json:"mfaAccounts"`
MfaItems []*MfaItem `xorm:"mediumtext" json:"mfaItems"`
MfaRememberDeadline string `xorm:"varchar(100)" json:"mfaRememberDeadline"`
NeedUpdatePassword bool `json:"needUpdatePassword"`
IpWhitelist string `xorm:"varchar(200)" json:"ipWhitelist"`
ApplicationScopes []ConsentRecord `xorm:"mediumtext" json:"applicationScopes"`
}
func CheckUserPassword ¶
func GetFilteredUser ¶
func GetGlobalUsers ¶
func GetGroupUsers ¶
func GetMaskedUser ¶
func GetPaginationGroupUsers ¶
func GetPaginationUsers ¶
func GetUserByAccessKey ¶
func GetUserByEmailOnly ¶
func GetUserByField ¶
func GetUserByFieldCrossOrg ¶
GetUserByFieldCrossOrg looks up a user by field across ALL organizations. Used as a fallback when the org-scoped lookup fails, enabling multi-tenant login where users may belong to a different org than the app's org.
With orgIsolation=sqlite each org's user rows live in a separate DB file, so a single global query cannot see them. We iterate per-org engines for the configured tenant orgs; the global engine still answers when isolation is disabled.
func GetUserByInvitationCode ¶
func GetUserByKerberosName ¶
GetUserByKerberosName looks up a user by their Kerberos principal name. It strips the realm part (e.g., "user@REALM.COM" -> "user") and searches by username.
func GetUserByPhone ¶
GetUserByPhone looks up a user by phone within an organization.
Phone normalization: `phone` is normalized to E.164 before the query. The caller MAY pass either a raw national number plus a separate country code via GetUserByPhoneWithCountry, or a phone string that already carries a '+' prefix. Inputs that cannot be normalized fall back to a verbatim query so legacy callers that already passed E.164 continue to work; the stored row is authoritative E.164 after the one-shot migration in object.MigratePhoneToE164.
func GetUserByPhoneOnly ¶
GetUserByPhoneOnly is the cross-org variant used by the OTP verification path. Same normalization invariant as GetUserByPhone.
func GetUserByPhoneWithCountry ¶ added in v1.18.7
GetUserByPhoneWithCountry is the canonical phone lookup: normalizes (phone, countryCode) to E.164 and queries `User.Phone` exactly. No fallback to national-number matching — that is the collision path that orphaned orders before this change. If the input cannot be parsed, returns (nil, nil) — a non-normalizable phone never matches a stored E.164 row.
func GetUserByUserIdOnly ¶
func GetUserByWebauthID ¶
func GetUserNoCheck ¶
func GetUsersByFieldCrossOrg ¶ added in v1.25.4
GetUsersByFieldCrossOrg returns ALL users matching field=value across every organization — the global engine plus each per-org SQLite under orgIsolation=sqlite. GetUserByFieldCrossOrg stops at the first match (fine for a plain lookup); the auth layer needs the full colliding set so it can select the row whose password verifies. Deduplicated by (owner, name).
func GetUsersByTagWithFilter ¶
func NewAdminUser ¶ added in v1.14.21
func NewAdminUser() *User
NewAdminUser returns the bootstrap admin user placeholder.
func VerifyWalletLogin ¶ added in v1.22.1
func VerifyWalletLogin(in WalletLoginInput) (*User, error)
VerifyWalletLogin is the one server-side entry point for multi-chain wallet login. Fail closed at every step:
- Parse the SIGNED CAIP-122 message; read the nonce from it (not the body), so a forged body can't desync nonce from signature.
- Atomically BURN the nonce BEFORE crypto -- a captured proof can never be replayed even if verification would otherwise succeed.
- walletconnect.VerifyProof: address-binding + domain + nonce + time + the per-chain cryptographic check. Identity = res.Address (canonical), never the client-claimed address.
- Resolve (chain,verifiedAddress) -> WalletLink -> user: - existing link -> log that user in - no link + session user -> link the new wallet to the session identity - no link + signup allowed -> provision "<chain>_<address>" user + link - no link + login-only -> error (no account linked to this wallet)
Returns the resolved user; the caller mints the session/JWT via HandleLoggedIn.
func (*User) AddCredentials ¶
func (*User) CheckUserFace ¶
func (*User) CredentialExcludeList ¶
func (user *User) CredentialExcludeList() []protocol.CredentialDescriptor
CredentialExcludeList returns a CredentialDescriptor array filled with all the user's credentials
func (*User) DeleteCredentials ¶
func (*User) GetCountryCode ¶
func (*User) GetFriendlyName ¶
func (*User) GetPreferredMfaProps ¶
func (*User) GetUserFullGroupPath ¶
func (*User) IsAdminUser ¶
func (*User) IsApplicationAdmin ¶
func (user *User) IsApplicationAdmin(application *Application) bool
func (*User) IsGlobalAdmin ¶
func (*User) IsMfaEnabled ¶
func (*User) UpdateUserHash ¶
func (*User) UpdateUserPassword ¶
func (user *User) UpdateUserPassword(organization *Organization)
func (*User) WebAuthnCredentials ¶
func (user *User) WebAuthnCredentials() []webauthn.Credential
func (*User) WebAuthnDisplayName ¶
func (*User) WebAuthnID ¶
WebAuthnID implementation of webauthn.User interface
func (*User) WebAuthnIcon ¶
func (*User) WebAuthnName ¶
type UserGroupEnforcer ¶
type UserGroupEnforcer struct {
// contains filtered or unexported fields
}
func NewUserGroupEnforcer ¶
func NewUserGroupEnforcer(enforcer *authz.Enforcer) *UserGroupEnforcer
func (*UserGroupEnforcer) AddGroupForUser ¶
func (e *UserGroupEnforcer) AddGroupForUser(user string, group string) (bool, error)
func (*UserGroupEnforcer) AddGroupsForUser ¶
func (e *UserGroupEnforcer) AddGroupsForUser(user string, groups []string) (bool, error)
func (*UserGroupEnforcer) DeleteGroupForUser ¶
func (e *UserGroupEnforcer) DeleteGroupForUser(user string, group string) (bool, error)
func (*UserGroupEnforcer) DeleteGroupsForUser ¶
func (e *UserGroupEnforcer) DeleteGroupsForUser(user string) (bool, error)
func (*UserGroupEnforcer) GetAllUsersByGroup ¶
func (e *UserGroupEnforcer) GetAllUsersByGroup(group string) ([]string, error)
func (*UserGroupEnforcer) GetGroupsForUser ¶
func (e *UserGroupEnforcer) GetGroupsForUser(user string) ([]string, error)
func (*UserGroupEnforcer) GetUserNamesByGroupName ¶
func (e *UserGroupEnforcer) GetUserNamesByGroupName(groupName string) ([]string, error)
func (*UserGroupEnforcer) UpdateGroupsForUser ¶
func (e *UserGroupEnforcer) UpdateGroupsForUser(user string, groups []string) (bool, error)
type UserShort ¶
type UserShort struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
Id string `xorm:"varchar(100) index" json:"id"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Avatar string `xorm:"varchar(500)" json:"avatar"`
Email string `xorm:"varchar(100) index" json:"email"`
EmailVerified bool `json:"email_verified,omitempty"`
Phone string `xorm:"varchar(100) index" json:"phone"`
}
type UserStandard ¶
type UserStandard struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"preferred_username,omitempty"`
Id string `xorm:"varchar(100) index" json:"id"`
DisplayName string `xorm:"varchar(100)" json:"name,omitempty"`
Avatar string `xorm:"varchar(500)" json:"picture,omitempty"`
Email string `xorm:"varchar(100) index" json:"email,omitempty"`
EmailVerified bool `json:"email_verified,omitempty"`
Phone string `xorm:"varchar(100) index" json:"phone,omitempty"`
}
type UserWithoutThirdIdp ¶
type UserWithoutThirdIdp struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100) index" json:"createdTime"`
UpdatedTime string `xorm:"varchar(100)" json:"updatedTime"`
DeletedTime string `xorm:"varchar(100)" json:"deletedTime"`
Id string `xorm:"varchar(100) index" json:"id"`
Type string `xorm:"varchar(100)" json:"type"`
Password string `xorm:"varchar(150)" json:"password"`
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
FirstName string `xorm:"varchar(100)" json:"firstName"`
LastName string `xorm:"varchar(100)" json:"lastName"`
Avatar string `xorm:"varchar(500)" json:"avatar"`
AvatarType string `xorm:"varchar(100)" json:"avatarType"`
PermanentAvatar string `xorm:"varchar(500)" json:"permanentAvatar"`
Email string `xorm:"varchar(100) index" json:"email"`
EmailVerified bool `json:"email_verified"`
Phone string `xorm:"varchar(100) index" json:"phone"`
CountryCode string `xorm:"varchar(6)" json:"countryCode"`
Region string `xorm:"varchar(100)" json:"region"`
Location string `xorm:"varchar(100)" json:"location"`
Address []string `json:"address"`
Affiliation string `xorm:"varchar(100)" json:"affiliation"`
Title string `xorm:"varchar(100)" json:"title"`
IdCardType string `xorm:"varchar(100)" json:"idCardType"`
IdCard string `xorm:"varchar(100) index" json:"idCard"`
Homepage string `xorm:"varchar(100)" json:"homepage"`
Bio string `xorm:"varchar(100)" json:"bio"`
Tag string `xorm:"varchar(100)" json:"tag"`
Language string `xorm:"varchar(100)" json:"language"`
Gender string `xorm:"varchar(100)" json:"gender"`
Birthday string `xorm:"varchar(100)" json:"birthday"`
Education string `xorm:"varchar(100)" json:"education"`
Score int `json:"score"`
Karma int `json:"karma"`
Ranking int `json:"ranking"`
IsDefaultAvatar bool `json:"isDefaultAvatar"`
IsOnline bool `json:"isOnline"`
IsAdmin bool `json:"isAdmin"`
IsForbidden bool `json:"isForbidden"`
IsDeleted bool `json:"isDeleted"`
SignupApplication string `xorm:"varchar(100)" json:"signupApplication"`
Hash string `xorm:"varchar(100)" json:"hash"`
PreHash string `xorm:"varchar(100)" json:"preHash"`
RegisterType string `xorm:"varchar(100)" json:"registerType"`
RegisterSource string `xorm:"varchar(100)" json:"registerSource"`
GitHub string `xorm:"github varchar(100)" json:"github"`
Google string `xorm:"varchar(100)" json:"google"`
QQ string `xorm:"qq varchar(100)" json:"qq"`
WeChat string `xorm:"wechat varchar(100)" json:"wechat"`
Facebook string `xorm:"facebook varchar(100)" json:"facebook"`
DingTalk string `xorm:"dingtalk varchar(100)" json:"dingtalk"`
Weibo string `xorm:"weibo varchar(100)" json:"weibo"`
Gitee string `xorm:"gitee varchar(100)" json:"gitee"`
LinkedIn string `xorm:"linkedin varchar(100)" json:"linkedin"`
Wecom string `xorm:"wecom varchar(100)" json:"wecom"`
Lark string `xorm:"lark varchar(100)" json:"lark"`
Gitlab string `xorm:"gitlab varchar(100)" json:"gitlab"`
CreatedIp string `xorm:"varchar(100)" json:"createdIp"`
LastSigninTime string `xorm:"varchar(100)" json:"lastSigninTime"`
LastSigninIp string `xorm:"varchar(100)" json:"lastSigninIp"`
// WebauthnCredentials []webauthn.Credential `xorm:"webauthnCredentials blob" json:"webauthnCredentials"`
PreferredMfaType string `xorm:"varchar(100)" json:"preferredMfaType"`
RecoveryCodes []string `xorm:"mediumtext" json:"recoveryCodes"`
TotpSecret string `xorm:"varchar(100)" json:"totpSecret"`
MfaPhoneEnabled bool `json:"mfaPhoneEnabled"`
MfaEmailEnabled bool `json:"mfaEmailEnabled"`
Ldap string `xorm:"ldap varchar(100)" json:"ldap"`
Properties map[string]string `json:"properties"`
Roles []*Role `json:"roles"`
Permissions []*Permission `json:"permissions"`
Groups []string `xorm:"groups varchar(1000)" json:"groups"`
LastSigninWrongTime string `xorm:"varchar(100)" json:"lastSigninWrongTime"`
SigninWrongTimes int `json:"signinWrongTimes"`
ManagedAccounts []ManagedAccount `xorm:"managedAccounts blob" json:"managedAccounts"`
}
type Userinfo ¶
type Userinfo struct {
Sub string `json:"sub"`
Iss string `json:"iss"`
Aud string `json:"aud"`
// Owner is the tenant/org slug (the org the user belongs to). It is the
// canonical org claim across IAM's OIDC surface and JWTs — the gateway
// derives X-Org-Id from it (see the 2026-03-27 header convention), and
// migrated clients read it to scope tenancy. Organization mirrors it under
// the standard OIDC-friendly name so consumers can read either.
Owner string `json:"owner"`
Organization string `json:"organization,omitempty"`
Name string `json:"preferred_username,omitempty"`
DisplayName string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
EmailVerified bool `json:"email_verified,omitempty"`
Avatar string `json:"picture,omitempty"`
Address string `json:"address,omitempty"`
Phone string `json:"phone,omitempty"`
RealName string `json:"real_name,omitempty"`
IsVerified bool `json:"is_verified,omitempty"`
Groups []string `json:"groups,omitempty"`
Roles []string `json:"roles,omitempty"`
Permissions []string `json:"permissions,omitempty"`
}
type ValidatorFunc ¶
type VerificationRecord ¶
type VerificationRecord struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
RemoteAddr string `xorm:"varchar(100)" json:"remoteAddr"`
Type string `xorm:"varchar(10)" json:"type"`
User string `xorm:"varchar(100) notnull" json:"user"`
Provider string `xorm:"varchar(100) notnull" json:"provider"`
Receiver string `xorm:"varchar(100) index notnull" json:"receiver"`
Code string `xorm:"varchar(10) notnull" json:"code"`
Time int64 `xorm:"notnull" json:"time"`
IsUsed bool `xorm:"notnull" json:"isUsed"`
}
func GetPaginationVerifications ¶
func GetPaginationVerifications(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*VerificationRecord, error)
func GetUserVerifications ¶
func GetUserVerifications(owner, user string) ([]*VerificationRecord, error)
func GetVerification ¶
func GetVerification(id string) (*VerificationRecord, error)
func GetVerifications ¶
func GetVerifications(owner string) ([]*VerificationRecord, error)
type VerifyResult ¶
func CheckVerificationCode ¶
func CheckVerificationCode(dest string, code string, lang string) (*VerifyResult, error)
type ViaSSHDialer ¶
func (*ViaSSHDialer) DialContext ¶
func (*ViaSSHDialer) DialTimeout ¶
type WalletLink ¶ added in v1.22.1
type WalletLink struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"` // organization
User string `xorm:"varchar(100) notnull pk" json:"user"` // user.Name
Chain string `xorm:"varchar(20) notnull pk unique(chain_addr)" json:"chain"`
Address string `xorm:"varchar(128) notnull pk unique(chain_addr)" json:"address"`
Scheme string `xorm:"varchar(40)" json:"scheme"`
PublicKey string `xorm:"varchar(256)" json:"publicKey"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
}
func GetWalletLink ¶ added in v1.22.1
func GetWalletLink(organization, chain, address string) (*WalletLink, error)
GetWalletLink resolves a verified (chain,address) to its link row, scoped to the application's organization. Returns (nil, nil) when no wallet is on file.
NOTE: address is compared as the verifier canonicalizes it. For EVM the verifier returns a lowercased 0x address, so store + look up the verifier's canonical form to keep EVM case-insensitive.
func GetWalletLinkGlobal ¶ added in v1.22.1
func GetWalletLinkGlobal(chain, address string) (*WalletLink, error)
GetWalletLinkGlobal resolves a verified (chain,address) across every organization. The (chain,address) pair is globally unique, so this returns at most one row. Used to enforce "a wallet binds to at most one identity" even across orgs before a new link is created.
func GetWalletLinksByUser ¶ added in v1.22.1
func GetWalletLinksByUser(owner, user string) ([]*WalletLink, error)
GetWalletLinksByUser lists every wallet a user has linked (for account UI).
type WalletLoginInput ¶ added in v1.22.1
type WalletLoginInput struct {
Domain string // host the nonce was minted against (re-checked vs the burned row)
Chain wc.Chain
Scheme string
Address string
PublicKey string
Message string
Signature string
Extra map[string]interface{}
Method string // "signup" (default) | "login"
Application *Application
Organization *Organization
SessionUser *User // non-nil => an authenticated caller linking a new wallet
}
WalletLoginInput is everything the auth core needs to verify a wallet login and resolve it to a user. It is a walletconnect proof plus the routing context the HTTP shell has already resolved (application/organization) and, for the "link a new wallet to my existing account" flow, the authenticated session user (nil when anonymous).
type Web3Nonce ¶ added in v1.22.1
type Web3Nonce struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"` // the nonce string itself
Chain string `xorm:"varchar(20)" json:"chain"`
Address string `xorm:"varchar(128)" json:"address"`
Domain string `xorm:"varchar(128)" json:"domain"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
ExpireTime string `xorm:"varchar(100)" json:"expireTime"`
Used bool `xorm:"bool" json:"used"`
}
func BurnWeb3Nonce ¶ added in v1.22.1
BurnWeb3Nonce atomically consumes a nonce. Returns the row iff it existed, was unused, and is unexpired; otherwise (nil, nil). The conditional UPDATE is the replay guard -- never split "read then write".
func MintWeb3Challenge ¶ added in v1.22.1
func MintWeb3Challenge(domain string, chain wc.Chain, address string) (*Web3Nonce, *wc.LoginChallenge, error)
MintWeb3Challenge creates a single-use login nonce, persists it, and returns both the stored row and the CAIP-122 LoginChallenge the wallet must sign.
domain MUST be the brand login host derived from the request (hanzo.id / lux.id / ...), never client-supplied -- phishing protection rides on the domain binding. chain/address are advisory (scoping/rate-limit hints); the authoritative binding happens in VerifyWalletLogin against the SIGNED message.
type WebFinger ¶
type WebFinger struct {
Subject string `json:"subject"`
Links []WebFingerLink `json:"links"`
Aliases *[]string `json:"aliases,omitempty"`
Properties *map[string]string `json:"properties,omitempty"`
}
type WebFingerLink ¶
type Webhook ¶
type Webhook struct {
Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
Organization string `xorm:"varchar(100) index" json:"organization"`
Url string `xorm:"varchar(200)" json:"url"`
Method string `xorm:"varchar(100)" json:"method"`
ContentType string `xorm:"varchar(100)" json:"contentType"`
Headers []*Header `xorm:"mediumtext" json:"headers"`
Events []string `xorm:"mediumtext" json:"events"`
TokenFields []string `xorm:"mediumtext" json:"tokenFields"`
ObjectFields []string `xorm:"mediumtext" json:"objectFields"`
IsUserExtended bool `json:"isUserExtended"`
SingleOrgOnly bool `json:"singleOrgOnly"`
IsEnabled bool `json:"isEnabled"`
}
func GetPaginationWebhooks ¶
func GetWebhook ¶
type WecomAccessTokenResp ¶
type WecomDeptListResp ¶
type WecomSyncerProvider ¶
type WecomSyncerProvider struct {
Syncer *Syncer
}
WecomSyncerProvider implements SyncerProvider for WeCom (WeChat Work) API-based syncers
func (*WecomSyncerProvider) AddUser ¶
func (p *WecomSyncerProvider) AddUser(user *OriginalUser) (bool, error)
AddUser adds a new user to WeCom (not supported for read-only API)
func (*WecomSyncerProvider) Close ¶
func (p *WecomSyncerProvider) Close() error
Close closes any open connections (no-op for WeCom API-based syncer)
func (*WecomSyncerProvider) GetOriginalGroups ¶
func (p *WecomSyncerProvider) GetOriginalGroups() ([]*OriginalGroup, error)
GetOriginalGroups retrieves all groups from WeCom (not implemented yet)
func (*WecomSyncerProvider) GetOriginalUserGroups ¶
func (p *WecomSyncerProvider) GetOriginalUserGroups(userId string) ([]string, error)
GetOriginalUserGroups retrieves the group IDs that a user belongs to (not implemented yet)
func (*WecomSyncerProvider) GetOriginalUsers ¶
func (p *WecomSyncerProvider) GetOriginalUsers() ([]*OriginalUser, error)
GetOriginalUsers retrieves all users from WeCom API
func (*WecomSyncerProvider) InitAdapter ¶
func (p *WecomSyncerProvider) InitAdapter() error
InitAdapter initializes the WeCom syncer (no database adapter needed)
func (*WecomSyncerProvider) TestConnection ¶
func (p *WecomSyncerProvider) TestConnection() error
TestConnection tests the WeCom API connection
func (*WecomSyncerProvider) UpdateUser ¶
func (p *WecomSyncerProvider) UpdateUser(user *OriginalUser) (bool, error)
UpdateUser updates an existing user in WeCom (not supported for read-only API)
type WecomUser ¶
type WecomUser struct {
UserId string `json:"userid"`
Name string `json:"name"`
Department []int `json:"department"`
Position string `json:"position"`
Mobile string `json:"mobile"`
Gender string `json:"gender"`
Email string `json:"email"`
Avatar string `json:"avatar"`
Status int `json:"status"`
Enable int `json:"enable"`
}
type WecomUserListResp ¶
type X509Certificate ¶
type X509Data ¶
type X509Data struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# X509Data"`
X509Certificate X509Certificate `xml:",innerxml"`
}
Source Files
¶
- adapter.go
- adapter_safe.go
- admin.go
- app_authz.go
- application.go
- application_cache.go
- application_item.go
- authz_engine.go
- avatar.go
- captcha.go
- cert.go
- cert_cache.go
- cert_whois.go
- check.go
- check_ip.go
- check_password_complexity.go
- check_password_expired.go
- check_util.go
- coredump_linux.go
- enforcer.go
- filelock_unix.go
- form.go
- get-dashboard.go
- group.go
- group_upload.go
- init.go
- init_data.go
- init_data_dump.go
- invitation.go
- jwks_cache.go
- jwt_mldsa65.go
- kerberos.go
- key.go
- kms.go
- ldap.go
- ldap_autosync.go
- ldap_conn.go
- ldap_password_type.go
- mfa.go
- mfa_push.go
- mfa_radius.go
- mfa_sms.go
- mfa_totp.go
- migrate_permission_json.go
- migrate_phone_e164.go
- migration.go
- migration_copy.go
- model.go
- notification.go
- notify_delivery.go
- notify_delivery_http.go
- oauth_dcr.go
- organization.go
- organization_cache.go
- orgdb.go
- orgdb_middleware.go
- ormer.go
- ormer_session.go
- otp_provider.go
- permission.go
- permission_enforcer.go
- permission_upload.go
- project.go
- prometheus.go
- provider.go
- provider_item.go
- radius.go
- record.go
- resource.go
- resource_direct.go
- role.go
- role_upload.go
- rule.go
- rule_cache.go
- saml_idp.go
- saml_sp.go
- server.go
- session.go
- site.go
- site_cache.go
- site_cert.go
- site_cert_account.go
- site_cert_ecc.go
- site_cert_http.go
- site_timer.go
- site_timer_health.go
- storage.go
- syncer.go
- syncer_activedirectory.go
- syncer_affiliation.go
- syncer_awsiam.go
- syncer_azuread.go
- syncer_cron.go
- syncer_database.go
- syncer_dingtalk.go
- syncer_group.go
- syncer_interface.go
- syncer_keycloak.go
- syncer_lark.go
- syncer_okta.go
- syncer_public_api.go
- syncer_scim.go
- syncer_sync.go
- syncer_user.go
- syncer_util.go
- syncer_wecom.go
- ticket.go
- token.go
- token_cas.go
- token_cleanup.go
- token_jwt.go
- token_jwt_key.go
- token_oauth.go
- token_revocation.go
- token_standard_jwt.go
- user.go
- user_avatar.go
- user_avatar_favicon.go
- user_avatar_gravatar.go
- user_avatar_identicon.go
- user_cache.go
- user_cred.go
- user_enforcer.go
- user_scope.go
- user_upload.go
- user_util.go
- user_webauthn.go
- util.go
- verification.go
- viaSSHDialer.go
- web3_auth.go
- web3_store.go
- webhook.go
- webhook_util.go
- wellknown_oauth_prm.go
- wellknown_oidc_discovery.go
- xorm_compat.go