Documentation
¶
Index ¶
- Constants
- func Sync2Db(x *gorm.DB)
- type Authorization_fake
- type Client
- func (c *Client) GetClientId() string
- func (c *Client) GetClientName() string
- func (c *Client) GetGrantTypes() []string
- func (c *Client) GetPostLogoutUris() []string
- func (c *Client) GetRedirectUris() []string
- func (c *Client) GetRequireConsent() bool
- func (c *Client) GetRequirePKCE() bool
- func (c *Client) GetScopes() []string
- func (c *Client) GetSecret() []string
- func (c *Client) GetWebOrigins() []string
- func (c *Client) SetGrantTypes(val []string)
- func (c *Client) TableName() string
- type ClientCorsOrigins
- type ClientPostLogoutRedirectURIs
- type ClientSecrets
- type Expression
- type Group
- type IntRecord
- type OrganizationUnit
- type PersistedGrants
- type Record
- type Role
- type Scopes
- type SnowflakeRecord
- type User
- type UserLogins
- type UserRoles
- type UserTokens
Constants ¶
View Source
const ( CONST_USERNAMEKEY = "user" CONST_USERIDKEY = "userid" CONST_OUKEY = "org" CONST_OUIDKEY = "orgid" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authorization_fake ¶ added in v0.0.2
type Authorization_fake struct {
Id string `json:"id" gorm:"primary_key;type:varchar(36);not null"`
Issuer string `json:"iss" gorm:"type:varchar(256);"`
ClientId string `json:"client_id" gorm:"type:varchar(256);"`
PrincipalName string `json:"principal_name" gorm:"type:varchar(256);"`
Subject string `json:"subject" gorm:"type:varchar(256);"`
GrantType string `json:"grant_type" gorm:"type:varchar(256);"`
ResponseType string `json:"response_type" gorm:"type:varchar(256);"`
Scope string `json:"scope" gorm:"type:varchar(256);"`
Code string `json:"code" gorm:"type:varchar(256);index"`
Nonce string `json:"nonce" gorm:"type:varchar(256);"`
AccessToken string `json:"access_token" gorm:"type:varchar(2560);index" `
RefreshToken string `json:"refresh_token" gorm:"type:varchar(256);index"`
IDToken string `json:"id_token" gorm:"type:varchar(2560);index"`
CodeChallenge string `json:"code_challenge" gorm:"type:varchar(256);"`
CodeChallengeMethod string `json:"code_challenge_method" gorm:"type:varchar(256);"`
DeviceCode string `json:"device_code" gorm:"type:varchar(256);index"`
ExpiresAt int64 `json:"expires_at"` //Unix timestamp
RefreshTokenExpiresAt int64 `json:"refresh_token_expires_at"`
UserCode string `json:"user_code" gorm:"type:varchar(256);index"`
}
Ony use for define gorm db schema
func (*Authorization_fake) TableName ¶ added in v0.0.2
func (r *Authorization_fake) TableName() string
type Client ¶
type Client struct {
Enabled bool `gorm:"not null"`
ClientId string `gorm:"uniqueIndex;type:varchar(256);not null"`
GrantTypes string `gorm:"type:varchar(256)"`
Scopes string `gorm:"type:varchar(256)"`
RedirectUris string `gorm:"type:varchar(4096)"`
ProtocolType string `gorm:"type:varchar(200);"`
RequireSecret bool `gorm:"not null"`
ClientName string `gorm:"type:varchar(200)"`
Description string `gorm:"type:varchar(1000)"`
ClientURI string `gorm:"type:varchar(2000)"`
LogoURI string `gorm:"type:varchar(2000)"`
RequireConsent bool `gorm:"not null"`
AllowRememberConsent bool `gorm:"not null"`
AlwaysIncludeUserClaimsInIdToken bool `gorm:"not null"`
RequirePkce bool `gorm:"not null"`
AllowPlainTextPkce bool `gorm:"not null"`
AllowAccessTokensViaBrowser bool `gorm:"not null"`
FrontChannelLogoutURI string `gorm:"type:varchar(2000)"`
FrontChannelLogoutSessionRequired bool `gorm:"not null"`
BackChannelLogoutURI string `gorm:"type:varchar(2000)"`
BackChannelLogoutSessionRequired bool `gorm:"not null"`
AllowOfflineAccess bool `gorm:"not null"`
IdentityTokenLifetime int `gorm:"type:int;not null"`
AccessTokenLifetime int `gorm:"type:int;not null"`
AuthorizationCodeLifetime int `gorm:"type:int;not null"`
ConsentLifetime int `gorm:"type:int"`
AbsoluteRefreshTokenLifetime int `gorm:"type:int;not null"`
SlidingRefreshTokenLifetime int `gorm:"type:int;not null"`
RefreshTokenUsage int `gorm:"type:int;not null"`
UpdateAccessTokenClaimsOnRefresh bool `gorm:"not null"`
RefreshTokenExpiration int `gorm:"type:int;not null"`
EnableLocalLogin bool `gorm:"not null"`
AlwaysSendClientClaims bool `gorm:"not null"`
ClientClaimsPrefix string `gorm:"type:varchar(200)"`
PairWiseSubjectSalt string `gorm:"type:varchar(200)"`
UserSsoLifetime int `gorm:"type:int"`
LogoutUris []ClientPostLogoutRedirectURIs `gorm:"foreignKey:ClientId"`
Secrets []ClientSecrets `gorm:"foreignKey:ClientId"`
Origins []ClientCorsOrigins `gorm:"foreignKey:ClientId"`
Claims datatypes.JSON
Properties datatypes.JSON
IntRecord `gorm:"embedded"`
}
Client [...]
func (*Client) GetClientId ¶ added in v0.0.2
func (*Client) GetClientName ¶ added in v0.0.2
func (*Client) GetGrantTypes ¶ added in v0.0.2
func (*Client) GetPostLogoutUris ¶ added in v0.0.2
func (*Client) GetRedirectUris ¶ added in v0.0.2
func (*Client) GetRequireConsent ¶
func (*Client) GetRequirePKCE ¶ added in v0.0.2
func (*Client) GetWebOrigins ¶ added in v0.0.2
func (*Client) SetGrantTypes ¶ added in v0.0.2
type ClientCorsOrigins ¶
type ClientCorsOrigins struct {
Origin string `gorm:"type:varchar(150);not null"`
ClientId int64 `gorm:"index:IX_ClientCorsOrigins_ClientId;type:bigint;not null"`
IntRecord `gorm:"embedded"`
}
ClientCorsOrigins [...]
type ClientPostLogoutRedirectURIs ¶
type ClientPostLogoutRedirectURIs struct {
PostLogoutRedirectURI string `gorm:"type:varchar(2000);not null"`
ClientId int64 `gorm:"type:bigint;not null"`
IntRecord `gorm:"embedded"`
}
ClientPostLogoutRedirectURIs [...]
type ClientSecrets ¶
type ClientSecrets struct {
Name string `gorm:"type:varchar(100)"`
Value string `gorm:"type:varchar(256);not null"`
Expiration time.Time `gorm:"column:expiration;"`
ClientId int64 `gorm:"type:varchar(256);not null"`
IntRecord `gorm:"embedded"`
}
ClientSecrets [...]
type Expression ¶ added in v0.0.2
type Expression struct {
Filter string
Column string
Value string
Operator string
Children []Expression
}
func (*Expression) IsLogical ¶ added in v0.0.2
func (e *Expression) IsLogical() bool
func (*Expression) NewSubExpression ¶ added in v0.0.2
func (e *Expression) NewSubExpression() *Expression
type Group ¶ added in v0.0.2
type Group struct {
SnowflakeRecord
Name string `json:"name" gorm:"type:varchar(200);not null"`
Description string `json:"description" gorm:"type:varchar(1000)"`
Members []User `gorm:"many2many:user_groups;"`
}
type IntRecord ¶ added in v0.0.2
type OrganizationUnit ¶
type OrganizationUnit struct {
Name string `json:"name" gorm:" type:varchar(255)"`
DisplayName string `json:"text" gorm:" type:varchar(255)"`
ParentId snowflake.ID `json:"parentId,omitempty" `
SortOrder int `json:"sortorder"`
Path string `json:"path" gorm:"type:varchar(2048)"`
Children []OrganizationUnit `json:"nodes" gorm:"foreignkey:ParentId;association_foreignkey:Id"`
SnowflakeRecord `gorm:"embedded"`
}
func (*OrganizationUnit) GetID ¶
func (m *OrganizationUnit) GetID() interface{}
//TableName 数据表名称
func (m *OrganizationUnit) TableName() string {
return "OrganizationUnit"
}
func (*OrganizationUnit) ParentID ¶
func (m *OrganizationUnit) ParentID() interface{}
func (m *OrganizationUnit) SetID(id interface{}) {
m.Id = fmt.Sprintf("%v", id)
}
func (*OrganizationUnit) SetChildren ¶
func (m *OrganizationUnit) SetChildren(children []interface{})
type PersistedGrants ¶
type PersistedGrants struct {
Principal string `gorm:"primaryKey;type:varchar(200)"`
ClientId string `gorm:"primaryKey;type:varchar(200);not null"`
Scope string `gorm:"type:text;not null"`
Record `gorm:"embedded"`
}
PersistedGrants [...]
func (*PersistedGrants) TableName ¶ added in v0.0.2
func (m *PersistedGrants) TableName() string
type Record ¶ added in v0.0.2
type Record struct {
Creator string `json:"creator" gorm:"type:varchar(255)"`
CreatorId string `json:"creatorId" gorm:"type:varchar(36)"`
Updator string `json:"updator" gorm:"type:varchar(255)"`
UpdatorId string `json:"updatorId" gorm:"type:varchar(36)"`
CreatedAt null.Time `json:"created" gorm:"autoCreateTime"`
UpdatedAt null.Time `json:"updated" gorm:"autoUpdateTime"`
}
Record 数据库通用结构
type Role ¶
type Role struct {
Name string `gorm:"type:varchar(256);unique"`
Description string `gorm:"type:varchar(256)"`
Users []User `gorm:"many2many:user_roles;"`
Claims datatypes.JSON
SnowflakeRecord `gorm:"embedded"`
}
Role [...]
type Scopes ¶ added in v0.0.2
type Scopes struct {
Enabled bool `gorm:"not null"`
Name string `gorm:"unique;type:varchar(200);not null"` //shold be lower case
Description string `gorm:"type:varchar(1000)"`
Properties datatypes.JSON
IntRecord `gorm:"embedded"`
}
oAuth2 Scopes
type SnowflakeRecord ¶ added in v0.0.2
type SnowflakeRecord struct {
Id snowflake.ID `json:"id,omitempty" gorm:"primary_key;not null"`
Record
}
SnowflakeRecord 数据库通用结构 ID generated by snowflake
func (*SnowflakeRecord) GetID ¶ added in v0.0.2
func (r *SnowflakeRecord) GetID() interface{}
type User ¶
type User struct {
OUId snowflake.ID `json:"ouid" gorm:"column:ou_id;"`
OU string `json:"ou" gorm:"type:varchar(256)"`
UserName string `json:"userName" gorm:"type:varchar(256)"`
DisplayName string `json:"displayname" gorm:"type:varchar(256)"`
Email string `json:"email" gorm:"type:varchar(256);unique"`
EmailConfirmed bool `json:"emailconfirmed" gorm:"not null"`
PasswordHash string `json:"-" gorm:"type:text"`
PhoneNumber string `json:"phonenumber" gorm:"type:text"`
PhoneNumberConfirmed bool `json:"phonenumberconfirmed" gorm:"not null"`
TwoFactorEnabled bool `json:"twofactorenabled" gorm:"not null"`
IsTemporaryPassword bool `json:"istemporarypassword" gorm:"not null"`
LockoutEnd null.Time `json:"lockoutend" gorm:""`
LockoutEnabled bool `json:"lockoutenabled" gorm:"not null"`
AccessFailedCount int `json:"accessfailedcount" gorm:"type:int;"`
Claims datatypes.JSON `json:"claims" gorm:"column:claims"`
SnowflakeRecord `gorm:"embedded"`
Roles []Role `gorm:"many2many:user_roles;"`
Logins []UserLogins `gorm:"foreignKey:UserId"`
Groups []Group `gorm:"many2many:user_groups;"`
}
User 用户信息
func (*User) GetPasswordHash ¶ added in v0.0.2
func (*User) GetUserName ¶ added in v0.0.2
type UserLogins ¶
type UserLogins struct {
LoginProvider string `gorm:"primary_key;type:varchar(255);not null"`
ProviderKey string `gorm:"primary_key;type:varchar(255);not null"`
ProviderDisplayName string `gorm:"type:text"`
UserId string `gorm:"index:IX_UserLogins_UserId;type:varchar(255);not null"`
Record `gorm:"embedded"`
}
UserLogins [...]
Source Files
¶
Click to show internal directories.
Click to hide internal directories.