Documentation
¶
Index ¶
- Constants
- type AccessToken
- type AuthCodeRevolk
- type AuthCodeScope
- type AuthorizationCode
- type Client
- type ClientAllowedURI
- type ClientGrantType
- type ClientRedirectURI
- type ClientRole
- type ClientRoleURI
- type ClientScope
- type CredentialsGrant
- type ImplicitGrant
- type ImplicitScope
- type Oauth2DB
- type PasswordGrant
- type RefreshToken
- type RoleURI
Constants ¶
View Source
const (
//TimeFormat TimeFormat
TimeFormat = "2006-01-02 15:04:05"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
AccessToken AccessToken
type AuthCodeRevolk ¶
AuthCodeRevolk AuthCodeRevolk
type AuthCodeScope ¶
AuthCodeScope AuthCodeScope
type AuthorizationCode ¶
type AuthorizationCode struct {
AuthorizationCode int64
ClientID int64
UserID string
Expires time.Time
AccessTokenID int64
RandonAuthCode string
AlreadyUsed bool
Scope string
}
AuthorizationCode AuthorizationCode
type Client ¶
type Client struct {
ClientID int64 `json:"clientId"`
Secret string `json:"secret"`
Name string `json:"name"`
WebSite string `json:"webSite"`
Email string `json:"email"`
Enabled bool `json:"enabled"`
Paid bool `json:"paid"`
}
Client Client
type ClientAllowedURI ¶
ClientAllowedURI ClientAllowedURI
type ClientGrantType ¶
ClientGrantType ClientGrantType
type ClientRedirectURI ¶
ClientRedirectURI ClientRedirectURI
type ClientRole ¶
ClientRole ClientRole
type ClientRoleURI ¶
ClientRoleURI ClientRoleURI
type ClientScope ¶
ClientScope ClientScope
type CredentialsGrant ¶
CredentialsGrant CredentialsGrant
type ImplicitGrant ¶
type ImplicitGrant struct {
ID int64
ClientID int64
UserID string
AccessTokenID int64
Scope string
}
ImplicitGrant ImplicitGrant
type ImplicitScope ¶
ImplicitScope ImplicitScope
type Oauth2DB ¶
type Oauth2DB interface {
//client
AddClient(client *Client, uris *[]ClientRedirectURI) (bool, int64)
UpdateClient(client *Client) bool
GetClient(clientID int64) *Client
GetClients() *[]Client
SearchClients(name string) *[]Client
DeleteClient(clientID int64) bool
//Redirect URI
AddClientRedirectURI(tx dbtx.Transaction, ru *ClientRedirectURI) (bool, int64)
GetClientRedirectURIList(clientID int64) *[]ClientRedirectURI
GetClientRedirectURI(clientID int64, uri string) *ClientRedirectURI
DeleteClientRedirectURI(tx dbtx.Transaction, id int64) bool
DeleteClientAllRedirectURI(tx dbtx.Transaction, clientID int64) bool
//Allowed URI
AddClientAllowedURI(au *ClientAllowedURI) (bool, int64)
UpdateClientAllowedURI(au *ClientAllowedURI) bool
GetClientAllowedURIByID(id int64) *ClientAllowedURI
GetClientAllowedURIList(clientID int64) *[]ClientAllowedURI
GetClientAllowedURI(clientID int64, uri string) *ClientAllowedURI
DeleteClientAllowedURI(id int64) bool
//Roles
AddClientRole(r *ClientRole) (bool, int64)
GetClientRoleList(clientID int64) *[]ClientRole
DeleteClientRole(id int64) bool
//Scope
AddClientScope(s *ClientScope) (bool, int64)
GetClientScopeList(clientID int64) *[]ClientScope
DeleteClientScope(id int64) bool
//Role URI
AddClientRoleURI(r *ClientRoleURI) bool
GetClientRoleAllowedURIList(roleID int64) *[]ClientRoleURI
GetClientRoleAllowedURIListByClientID(clientID int64) *[]RoleURI
DeleteClientRoleURI(r *ClientRoleURI) bool
//Refresh Token
AddRefreshToken(tx dbtx.Transaction, t *RefreshToken) (bool, int64)
UpdateRefreshToken(t *RefreshToken) bool
GetRefreshToken(id int64) *RefreshToken
DeleteRefreshToken(tx dbtx.Transaction, id int64) bool
//Access Token
AddAccessToken(tx dbtx.Transaction, t *AccessToken) (bool, int64)
UpdateAccessToken(tx dbtx.Transaction, t *AccessToken) bool
GetAccessToken(id int64) *AccessToken
DeleteAccessToken(tx dbtx.Transaction, id int64) bool
//AuthorizationCode
AddAuthorizationCode(code *AuthorizationCode, at *AccessToken, rt *RefreshToken, scopeList *[]string) (bool, int64)
UpdateAuthorizationCode(code *AuthorizationCode) bool
UpdateAuthorizationCodeAndToken(code *AuthorizationCode, at *AccessToken) bool
GetAuthorizationCode(clientID int64, userID string) *[]AuthorizationCode
GetAuthorizationCodeByCode(code string) *AuthorizationCode
GetAuthorizationCodeByScope(clientID int64, userID string, scope string) *[]AuthorizationCode
DeleteAuthorizationCode(clientID int64, userID string) bool
//authcode revolk
AddAuthCodeRevolk(tx dbtx.Transaction, rv *AuthCodeRevolk) (bool, int64)
GetAuthCodeRevolk(ac int64) *AuthCodeRevolk
DeleteAuthCodeRevolk(tx dbtx.Transaction, ac int64) bool
//Auth code scope
GetAuthorizationCodeScopeList(ac int64) *[]AuthCodeScope
//grant types
AddClientGrantType(gt *ClientGrantType) (bool, int64)
GetClientGrantTypeList(cid int64) *[]ClientGrantType
DeleteClientGrantType(id int64) bool
//implicit grant
AddImplicitGrant(ig *ImplicitGrant, at *AccessToken, scopeList *[]string) (bool, int64)
GetImplicitGrant(clientID int64, userID string) *[]ImplicitGrant
GetImplicitGrantByScope(clientID int64, userID string, scope string) *[]ImplicitGrant
DeleteImplicitGrant(clientID int64, userID string) bool
//implicit grant scope
GetImplicitGrantScopeList(ig int64) *[]ImplicitScope
// Password grand
AddPasswordGrant(pwg *PasswordGrant, at *AccessToken, rt *RefreshToken) (bool, int64)
GetPasswordGrant(clientID int64, userID string) *[]PasswordGrant
DeletePasswordGrant(clientID int64, userID string) bool
//credentials grant
AddCredentialsGrant(cg *CredentialsGrant, at *AccessToken) (bool, int64)
GetCredentialsGrant(clientID int64) *[]CredentialsGrant
DeleteCredentialsGrant(clientID int64) bool
// keys
GetAccessTokenKey() string
GetRefreshTokenKey() string
GetSessionKey() string
}
Oauth2DB Oauth2DB
type PasswordGrant ¶
PasswordGrant PasswordGrant
Click to show internal directories.
Click to hide internal directories.