Documentation
¶
Index ¶
- Constants
- func ParseCallback(request *http.Request, expectedState string) (string, error)
- func ParseCallbackURL(rawURL, expectedRedirectURI, expectedState string) (string, error)
- type Authorization
- type Client
- type ManualAuthorization
- type ManualFlow
- type Metadata
- type TokenEndpointError
- type TokenResponse
Constants ¶
View Source
const NativeRedirectURI = "jms://auth/callback"
Variables ¶
This section is empty.
Functions ¶
func ParseCallback ¶
func ParseCallbackURL ¶
ParseCallbackURL 接受原生回调本身,或 next 参数中包含原生回调的 JumpServer 确认页 URL。
Types ¶
type Authorization ¶
func NewAuthorization ¶
type ManualAuthorization ¶
type ManualAuthorization struct {
URL string
// contains filtered or unexported fields
}
type ManualFlow ¶
type ManualFlow struct {
HTTPClient *http.Client
RedirectURI string
OpenBrowser func(string) error
Input io.Reader
Output io.Writer
Now func() time.Time
}
ManualFlow 读取用户粘贴的 URL 来完成原生 OAuth 回调。 当其他程序占用 jms scheme 或系统禁止注册私有协议时,它也是长期保留的回退方式。
func (ManualFlow) Login ¶
func (f ManualFlow) Login(ctx context.Context, site string) (credential.Token, error)
type Metadata ¶
type TokenEndpointError ¶
func (*TokenEndpointError) Error ¶
func (e *TokenEndpointError) Error() string
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
ExpiresIn int64 `json:"expires_in"`
}
func (TokenResponse) Record ¶
func (t TokenResponse) Record(clientID, site string, now time.Time) (credential.Token, error)
Click to show internal directories.
Click to hide internal directories.