Documentation
¶
Index ¶
Constants ¶
View Source
const ( DEFAULT_DISCOVERY_PATH = "/.well-known/openid-configuration" DEFAULT_JWKS_PATH = "/.well-known/jwks.json" DEFAULT_AUTHORIZATION_PATH = "/authorize" DEFAULT_TOKEN_PATH = "/token" DEFAULT_USERINFO_PATH = "/userinfo" DEFAULT_REGISTRATION_PATH = "/registration" DEFAULT_PUSHED_AUTHORIZATION_PATH = "/par" )
Variables ¶
This section is empty.
Functions ¶
func FapiResourceEndpointMiddleware ¶ added in v0.1.0
func FapiResourceEndpointMiddleware(next http.HandlerFunc) http.HandlerFunc
Types ¶
type ClientParam ¶
type ClientParam struct {
ClientId string
ClientSecret string
Meta *oppb.ClientMeta
Attribute *oppb.ClientAttribute
Extensions *oppb.ClientExtensions
}
type Config ¶
type Config struct {
ServerHostPort string `validate:"required"`
IssuerId string `validate:"required"`
IssuerPassword string `validate:"required"`
Callbacks SdkCallbacks `validate:"required"`
}
type IssueRequest ¶
type RequestInfo ¶ added in v0.1.0
type RequestInfo struct {
// RequestId is the unique identifier for the request.
RequestId string
// Client contains metadata about the client making the request.
Client *oppb.ClientMeta
// AuthParams contains the authorization parameters for the request.
AuthParams *oppb.AuthorizationParameters
}
RequestInfo holds information about a request.
type Sdk ¶
type Sdk interface {
DiscoveryEndpoint(w http.ResponseWriter, r *http.Request)
JwksEndpoint(w http.ResponseWriter, r *http.Request)
AuthorizationEndpoint(w http.ResponseWriter, r *http.Request)
TokenEndpoint(w http.ResponseWriter, r *http.Request)
UserinfoEndpoint(w http.ResponseWriter, r *http.Request)
RegistrationEndpoint(w http.ResponseWriter, r *http.Request)
PushedAuthorizationEndpoint(w http.ResponseWriter, r *http.Request)
// AuthorizationIssue issues an authorization request.
// w is the http.ResponseWriter to write the response to.
// r is the http.Request containing the request data.
// requestId is the ID of the authorization request.
// subject is the subject of the authorization request.
AuthorizationIssue(w http.ResponseWriter, r *http.Request, requestId, subject string)
// AuthorizationCancel cancels an authorization request.
// w is the http.ResponseWriter to write the response to.
// r is the http.Request containing the request data.
// requestId is the ID of the authorization request to cancel.
AuthorizationCancel(w http.ResponseWriter, r *http.Request, requestId string)
// WriteLoginHtml writes the login HTML response.
// w is the http.ResponseWriter to write the HTML to.
// r is the http.Request containing the request data.
// requestId is the ID of the authorization request.
// callbacks is the SdkCallbacks interface to handle callbacks.
WriteLoginHtml(w http.ResponseWriter, r *http.Request, requestId string, callbacks SdkCallbacks)
// GetRequestInfo retrieves information about a request.
// ctx is the context for the request.
// requestId is the ID of the request to retrieve information for.
GetRequestInfo(ctx context.Context, requestId string) (*RequestInfo, error)
//
ClientCreate(context.Context, ClientParam) error
SessionGroupCreate(context.Context, *oppb.SessionGroupCreateRequest) error
KeyRotate(context.Context, string) error
}
func NewHostedSdk ¶
func NewHostedSdk( ctx context.Context, issuerMeta *oppb.IssuerMeta, sdkCallbacks SdkCallbacks, providerCallbacks model.ProviderCallbacks) (Sdk, error)
func NewSemiHostedSdk ¶
type SdkCallbacks ¶
type SdkCallbacks interface {
// GetUserClaimsCallback retrieves user claims(json string) for a given subject.
// ctx is the context for the request.
// subject is the subject for which to retrieve claims.
GetUserClaimsCallback(ctx context.Context, subject string) (string, error)
// WriteLoginHtmlCallback writes the login HTML response.
// info is the RequestInfo containing request details.
// It returns an http.HandlerFunc that serves the HTML response.
WriteLoginHtmlCallback(info *RequestInfo) http.HandlerFunc
}
SdkCallbacks defines the callbacks for the SDK. It includes methods for retrieving user claims and writing login HTML.
type SetupHelper ¶ added in v0.1.0
type SetupHelper struct {
UseDiscovery bool
AuthorizationPath string
TokenPath string
UserinfoPath string
JwksPath string
RegistrationPath string
PushedAuthorizationPath string
}
func DefaultPaths ¶
func DefaultPaths() *SetupHelper
func (*SetupHelper) NewServeMux ¶ added in v0.1.0
func (p *SetupHelper) NewServeMux(sdk Sdk) *http.ServeMux
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
GoogleCloudHostedService
command
|
|
|
LocalHostedService
command
|
|
|
internal
|
|
|
pkg
|
|
|
testui
Package testui is a simple user interface for testing opgo.
|
Package testui is a simple user interface for testing opgo. |
Click to show internal directories.
Click to hide internal directories.