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 ConsentSkip(r *http.Request, client *http.Client, consent *hydraapi.ConsentRequest, ...) (bool, string, 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 ExtractIdentitiesInConsent(consent *hydraapi.ConsentRequest) ([]string, *status.Status)
- func ExtractLoginChallenge(r *http.Request) (string, *status.Status)
- func ExtractStateIDInConsent(consent *hydraapi.ConsentRequest) (string, *status.Status)
- 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 LoginSkip(w http.ResponseWriter, r *http.Request, client *http.Client, ...) bool
- 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 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 ConsentSkip ¶
func ConsentSkip(r *http.Request, client *http.Client, consent *hydraapi.ConsentRequest, hydraAdminURL, challenge string) (bool, string, error)
ConsentSkip if hydra was already able to consent the user, skip will be true and we do not need to re-consent the user. Returns whether a consent is required and redirect address for the conset page.
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 ExtractIdentitiesInConsent ¶
func ExtractIdentitiesInConsent(consent *hydraapi.ConsentRequest) ([]string, *status.Status)
ExtractIdentitiesInConsent extracts identities in ConsentRequest Context.
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 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 LoginSkip ¶
func LoginSkip(w http.ResponseWriter, r *http.Request, client *http.Client, login *hydraapi.LoginRequest, hydraAdminURL, challenge string) bool
LoginSkip if hydra was already able to authenticate the user, skip will be true and we do not need to re-authenticate the user.
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 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.