Documentation ¶
Index ¶
- Constants
- func GenClientID(appType models.AppType) string
- func MuskClientSecrets(clientSecrets []models.OauthClientSecret)
- type AuthorizeGenerateRequest
- type ClientIDGenerate
- type CreateOAuthAppReq
- type Manager
- type OauthManager
- func (m *OauthManager) CreateOauthApp(ctx context.Context, info *CreateOAuthAppReq) (*models.OauthApp, error)
- func (m *OauthManager) CreateSecret(ctx context.Context, clientID string) (*models.OauthClientSecret, error)
- func (m *OauthManager) DeleteOAuthApp(ctx context.Context, clientID string) error
- func (m *OauthManager) DeleteSecret(ctx context.Context, ClientID string, clientSecretID uint) error
- func (m *OauthManager) GenAuthorizeCode(ctx context.Context, req *AuthorizeGenerateRequest) (*tokenmodels.Token, error)
- func (m *OauthManager) GenOauthTokens(ctx context.Context, req *OauthTokensRequest) (*OauthTokensResponse, error)
- func (m *OauthManager) GetOAuthApp(ctx context.Context, clientID string) (*models.OauthApp, error)
- func (m *OauthManager) ListOauthApp(ctx context.Context, ownerType models.OwnerType, ownerID uint) ([]models.OauthApp, error)
- func (m *OauthManager) ListSecret(ctx context.Context, ClientID string) ([]models.OauthClientSecret, error)
- func (m *OauthManager) NewAccessToken(authorizationCodeToken *tokenmodels.Token, req *OauthTokensRequest) *tokenmodels.Token
- func (m *OauthManager) NewAuthorizationToken(req *AuthorizeGenerateRequest) *tokenmodels.Token
- func (m *OauthManager) NewRefreshToken(accessToken *tokenmodels.Token, req *OauthTokensRequest) *tokenmodels.Token
- func (m *OauthManager) RefreshOauthTokens(ctx context.Context, req *OauthTokensRequest) (*OauthTokensResponse, error)
- func (m *OauthManager) SetClientIDGenerate(gen ClientIDGenerate)
- func (m *OauthManager) UpdateOauthApp(ctx context.Context, clientID string, req UpdateOauthAppReq) (*models.OauthApp, error)
- type OauthTokensRequest
- type OauthTokensResponse
- type UpdateOauthAppReq
Constants ¶
View Source
const ( CutPostNum = 8 MustPrefix = "*****" )
musk the secrets
View Source
const BasicOauthClientLength = 20
View Source
const HorizonAPPClientIDPrefix = "ho_"
View Source
const OauthClientSecretLength = 40
Variables ¶
This section is empty.
Functions ¶
func GenClientID ¶
func MuskClientSecrets ¶
func MuskClientSecrets(clientSecrets []models.OauthClientSecret)
Types ¶
type ClientIDGenerate ¶
type CreateOAuthAppReq ¶
type Manager ¶
type Manager interface { CreateOauthApp(ctx context.Context, info *CreateOAuthAppReq) (*models.OauthApp, error) GetOAuthApp(ctx context.Context, clientID string) (*models.OauthApp, error) DeleteOAuthApp(ctx context.Context, clientID string) error ListOauthApp(ctx context.Context, ownerType models.OwnerType, ownerID uint) ([]models.OauthApp, error) UpdateOauthApp(ctx context.Context, clientID string, req UpdateOauthAppReq) (*models.OauthApp, error) CreateSecret(ctx context.Context, clientID string) (*models.OauthClientSecret, error) DeleteSecret(ctx context.Context, ClientID string, clientSecretID uint) error ListSecret(ctx context.Context, ClientID string) ([]models.OauthClientSecret, error) GenAuthorizeCode(ctx context.Context, req *AuthorizeGenerateRequest) (*tokenmodels.Token, error) GenOauthTokens(ctx context.Context, req *OauthTokensRequest) (*OauthTokensResponse, error) RefreshOauthTokens(ctx context.Context, req *OauthTokensRequest) (*OauthTokensResponse, error) }
type OauthManager ¶
type OauthManager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(oauthAppDAO oauthdao.DAO, tokenStore tokenstore.Store, gen generator.CodeGenerator, authorizeCodeExpireTime, accessTokenExpireTime, refreshTokenExpireTime time.Duration) *OauthManager
func (*OauthManager) CreateOauthApp ¶
func (m *OauthManager) CreateOauthApp(ctx context.Context, info *CreateOAuthAppReq) (*models.OauthApp, error)
func (*OauthManager) CreateSecret ¶
func (m *OauthManager) CreateSecret(ctx context.Context, clientID string) (*models.OauthClientSecret, error)
func (*OauthManager) DeleteOAuthApp ¶
func (m *OauthManager) DeleteOAuthApp(ctx context.Context, clientID string) error
func (*OauthManager) DeleteSecret ¶
func (*OauthManager) GenAuthorizeCode ¶
func (m *OauthManager) GenAuthorizeCode(ctx context.Context, req *AuthorizeGenerateRequest) (*tokenmodels.Token, error)
func (*OauthManager) GenOauthTokens ¶
func (m *OauthManager) GenOauthTokens(ctx context.Context, req *OauthTokensRequest) (*OauthTokensResponse, error)
func (*OauthManager) GetOAuthApp ¶
func (*OauthManager) ListOauthApp ¶
func (*OauthManager) ListSecret ¶
func (m *OauthManager) ListSecret(ctx context.Context, ClientID string) ([]models.OauthClientSecret, error)
func (*OauthManager) NewAccessToken ¶
func (m *OauthManager) NewAccessToken(authorizationCodeToken *tokenmodels.Token, req *OauthTokensRequest) *tokenmodels.Token
func (*OauthManager) NewAuthorizationToken ¶
func (m *OauthManager) NewAuthorizationToken(req *AuthorizeGenerateRequest) *tokenmodels.Token
func (*OauthManager) NewRefreshToken ¶
func (m *OauthManager) NewRefreshToken(accessToken *tokenmodels.Token, req *OauthTokensRequest) *tokenmodels.Token
func (*OauthManager) RefreshOauthTokens ¶
func (m *OauthManager) RefreshOauthTokens(ctx context.Context, req *OauthTokensRequest) (*OauthTokensResponse, error)
func (*OauthManager) SetClientIDGenerate ¶
func (m *OauthManager) SetClientIDGenerate(gen ClientIDGenerate)
func (*OauthManager) UpdateOauthApp ¶
func (m *OauthManager) UpdateOauthApp(ctx context.Context, clientID string, req UpdateOauthAppReq) (*models.OauthApp, error)
type OauthTokensRequest ¶
type OauthTokensResponse ¶
type OauthTokensResponse struct { AccessToken *tokenmodels.Token RefreshToken *tokenmodels.Token }
Click to show internal directories.
Click to hide internal directories.