Documentation ¶
Overview ¶
Package hydra contains helpers for using hydra
Index ¶
- Constants
- func AcceptConsent(client *http.Client, hydraAdminURL, challenge string, ...) (*hydraapi.RequestHandlerResponse, error)
- func AcceptLogin(client *http.Client, hydraAdminURL, challenge string, ...) (*hydraapi.RequestHandlerResponse, error)
- func CreateClient(client *http.Client, hydraAdminURL string, oauthClient *hydraapi.Client) (*hydraapi.Client, error)
- func DeleteClient(client *http.Client, hydraAdminURL, id string) error
- func ExtractConsentChallenge(r *http.Request) (string, *status.Status)
- func ExtractLoginChallenge(r *http.Request) (string, *status.Status)
- func ExtractStateIDInConsent(consent *hydraapi.ConsentRequest) (string, *status.Status)
- func ExtractTokenIDInConsentSession(session *hydraapi.PreviousConsentSession) (string, error)
- func ExtractTokenIDInIntrospect(in *hydraapi.Introspection) (string, error)
- func GetClient(client *http.Client, hydraAdminURL, id string) (*hydraapi.Client, error)
- func GetConsentRequest(client *http.Client, hydraAdminURL, challenge string) (*hydraapi.ConsentRequest, error)
- func GetLoginRequest(client *http.Client, hydraAdminURL, challenge string) (*hydraapi.LoginRequest, error)
- func Introspect(client *http.Client, hydraAdminURL, token string) (*hydraapi.Introspection, error)
- func ListClients(client *http.Client, hydraAdminURL string) ([]*hydraapi.Client, error)
- func ListConsents(client *http.Client, hydraAdminURL, subject string) ([]*hydraapi.PreviousConsentSession, error)
- func LoginSuccess(r *http.Request, client *http.Client, ...) (string, error)
- func NormalizeIdentity(id *ga4gh.Identity) *ga4gh.Identity
- func RejectConsent(client *http.Client, hydraAdminURL, challenge string, ...) (*hydraapi.RequestHandlerResponse, error)
- func RejectLogin(client *http.Client, hydraAdminURL, challenge string, ...) (*hydraapi.RequestHandlerResponse, error)
- func RevokeConsents(client *http.Client, hydraAdminURL, subject, clientID string) error
- func RevokeToken(client *http.Client, hydraAdminURL, token string) error
- func SendConsentReject(w http.ResponseWriter, r *http.Request, client *http.Client, ...)
- func SendLoginReject(w http.ResponseWriter, r *http.Request, client *http.Client, ...)
- func SendLoginSuccess(w http.ResponseWriter, r *http.Request, client *http.Client, ...)
- func UpdateClient(client *http.Client, hydraAdminURL, id string, oauthClient *hydraapi.Client) (*hydraapi.Client, error)
Constants ¶
const (
// StateIDKey uses to store stateID in hydra context.
StateIDKey = "state"
)
Variables ¶
This section is empty.
Functions ¶
func AcceptConsent ¶
func AcceptConsent(client *http.Client, hydraAdminURL, challenge string, r *hydraapi.HandledConsentRequest) (*hydraapi.RequestHandlerResponse, error)
AcceptConsent tells hydra to accept a consent request.
func AcceptLogin ¶
func AcceptLogin(client *http.Client, hydraAdminURL, challenge string, r *hydraapi.HandledLoginRequest) (*hydraapi.RequestHandlerResponse, error)
AcceptLogin tells hydra to accept a login request.
func CreateClient ¶
func CreateClient(client *http.Client, hydraAdminURL string, oauthClient *hydraapi.Client) (*hydraapi.Client, error)
CreateClient creates OAuth client in hydra.
func DeleteClient ¶
DeleteClient delete an existing OAuth 2.0 Client by its ID.
func ExtractConsentChallenge ¶
ExtractConsentChallenge extracts consent_challenge from request.
func ExtractLoginChallenge ¶
ExtractLoginChallenge extracts login_challenge from request.
func ExtractStateIDInConsent ¶
func ExtractStateIDInConsent(consent *hydraapi.ConsentRequest) (string, *status.Status)
ExtractStateIDInConsent extracts stateID in ConsentRequest Context.
func ExtractTokenIDInConsentSession ¶ added in v0.9.3
func ExtractTokenIDInConsentSession(session *hydraapi.PreviousConsentSession) (string, error)
ExtractTokenIDInConsentSession finds token id in consent session.
func ExtractTokenIDInIntrospect ¶ added in v0.8.6
func ExtractTokenIDInIntrospect(in *hydraapi.Introspection) (string, error)
ExtractTokenIDInIntrospect finds token id in introspect result, return error if not found or in wront type.
func GetConsentRequest ¶
func GetConsentRequest(client *http.Client, hydraAdminURL, challenge string) (*hydraapi.ConsentRequest, error)
GetConsentRequest fetches information on a consent request.
func GetLoginRequest ¶
func GetLoginRequest(client *http.Client, hydraAdminURL, challenge string) (*hydraapi.LoginRequest, error)
GetLoginRequest fetches information on a login request.
func Introspect ¶
Introspect token, validate the given token and return token claims.
func ListClients ¶
ListClients list all OAuth clients in hydra.
func ListConsents ¶
func ListConsents(client *http.Client, hydraAdminURL, subject string) ([]*hydraapi.PreviousConsentSession, error)
ListConsents lists all consents of user (subject).
func LoginSuccess ¶ added in v0.8.6
func LoginSuccess(r *http.Request, client *http.Client, hydraAdminURL, challenge, subject, stateID string, extra map[string]interface{}) (string, error)
LoginSuccess is the redirect for successful login.
func NormalizeIdentity ¶ added in v0.8.6
NormalizeIdentity converts hydra special format in access token to ga4gh.Identity 1. move "scp" to "scope" 2. move "extra.identities" to "identities"
func RejectConsent ¶
func RejectConsent(client *http.Client, hydraAdminURL, challenge string, r *hydraapi.RequestDeniedError) (*hydraapi.RequestHandlerResponse, error)
RejectConsent tells hydra to rejects a consent request.
func RejectLogin ¶
func RejectLogin(client *http.Client, hydraAdminURL, challenge string, r *hydraapi.RequestDeniedError) (*hydraapi.RequestHandlerResponse, error)
RejectLogin tells hydra to reject a login request.
func RevokeConsents ¶
RevokeConsents revokes all consents of user for a client. clientID is optional, will revoke all consent of user if no clientID.
func RevokeToken ¶ added in v0.8.6
RevokeToken revokes the given token, token maybe refresh token or access token.
func SendConsentReject ¶ added in v0.8.8
func SendConsentReject(w http.ResponseWriter, r *http.Request, client *http.Client, hydraAdminURL, challenge string, err error)
SendConsentReject to hydra, requires a status err.
func SendLoginReject ¶ added in v0.8.8
func SendLoginReject(w http.ResponseWriter, r *http.Request, client *http.Client, hydraAdminURL, challenge string, err error)
SendLoginReject to hydra, requires a status err.
func SendLoginSuccess ¶
func SendLoginSuccess(w http.ResponseWriter, r *http.Request, client *http.Client, hydraAdminURL, challenge, subject, stateID string, extra map[string]interface{})
SendLoginSuccess sends login success to hydra.
Types ¶
This section is empty.