フレームワーク内共通で使われる道具
Arguments
fosite内でパラメータに文字列スライスが使われる場合はこの型が使われます。
arguments.go
で定義されている
type Arguments []string
Arguments
には各種レシーバーメソッドが定義されています。
OAuth2のリクエストとレスポンス
基底にある型(interface)
Requester
fosite内でリクエストを扱うための抽象interfaceです。
oauth2.go
で定義されています
Session
OAuth2リクエスト接続を保持し、それを扱うためのinterface。
いわゆるHTTPセッションとは別ものだが、fosite読み始めの初期はとっつきにくいかもしれない。
session.go
で定義されている
interface定義
// Session is an interface that is used to store session data between OAuth2 requests. It can be used to look up
// when a session expires or what the subject's name was.
type Session interface {
// SetExpiresAt sets the expiration time of a token.
//
// session.SetExpiresAt(fosite.AccessToken, time.Now().UTC().Add(time.Hour))
SetExpiresAt(key TokenType, exp time.Time)
// GetExpiresAt returns the expiration time of a token if set, or time.IsZero() if not.
//
// session.GetExpiresAt(fosite.AccessToken)
GetExpiresAt(key TokenType) time.Time
// GetUsername returns the username, if set. This is optional and only used during token introspection.
GetUsername() string
// GetSubject returns the subject, if set. This is optional and only used during token introspection.
GetSubject() string
// Clone clones the session.
Clone() Session
}
Client
OAuth2のクライアントを表しています。
interfaceとなっていていてredirect_uriやパブリッククライアントかどうかを返すメソッドなどが定義されています。
認可エンドポイントのリクエストとレスポンス
AuthorizeRequester
認可エンドポイントへのリクエストコンテキストを扱うためのinterfaceです
Requester
を満たしています。
oauth2.go
で定義されています
interface定義
type AuthorizeRequester interface {
// GetResponseTypes returns the requested response types
GetResponseTypes() (responseTypes Arguments)
// SetResponseTypeHandled marks a response_type (e.g. token or code) as handled indicating that the response type
// is supported.
SetResponseTypeHandled(responseType string)
// DidHandleAllResponseTypes returns if all requested response types have been handled correctly
DidHandleAllResponseTypes() (didHandle bool)
// GetRedirectURI returns the requested redirect URI
GetRedirectURI() (redirectURL *url.URL)
// IsRedirectURIValid returns false if the redirect is not rfc-conform (i.e. missing client, not on white list,
// or malformed)
IsRedirectURIValid() (isValid bool)
// GetState returns the request's state.
GetState() (state string)
// GetResponseMode returns response_mode of the authorization request
GetResponseMode() ResponseModeType
// SetDefaultResponseMode sets default response mode for a response type in a flow
SetDefaultResponseMode(responseMode ResponseModeType)
// GetDefaultResponseMode gets default response mode for a response type in a flow
GetDefaultResponseMode() ResponseModeType
Requester
}
AuthorizeRequest
AuthorizeRequester
を満たす具象型です。
authorize_request.go
で定義されている。
AuthorizeResponder
認可エンドポイントのレスポンスを扱うためのinterfaceです
oauth2.go
で定義されています。
AuthorizeResponse
AuthorizeResponder
を満たす具象型です。
authorize_response.go
で定義されている。
トークンエンドポイントのリクエストとレスポンス
AccessRequester
トークンエンドポイントへのリクエストコンテキストを扱うためのinterfaceです.
oauth2.go
で定義されている
AccessRequest
トークンエンドポイントへのリクエストを表した構造体
AccessRequester
を満たす具象型です。
access_request.go
で定義されている。
AccessResponder
トークンエンドポイントからのレスポンスを扱うためのinterfaceです。
oauth2.go
で定義されています。
AccessResponse
AccessResponder
を満たす具象型です。
access_request.go
で定義されている。
トークンイントロスペクトのリクエストとレスポンス
リクエストについては型はありません
IntrospectionResponder
トークンイントロスペクトエンドポイントからのレスポンスを扱うためのinterfaceです。
oauth2.go
で定義されている
IntrospectionResponse
IntrospectionResponder
を満たす具象型です。
introspection_request_handler.go
で定義されている
トークンリボークのリクエストとレスポンス
リクエスト・レスポンスともに固有の型は定義されていません