client

package
v0.0.0-...-c304077 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2019 License: GPL-2.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteClient

func DeleteClient(url string, client_id string) (err error)

Types

type Client

type Client struct {
	Id                      string   `json:"client_id,omitempty"`
	Name                    string   `json:"client_name,omitempty"`
	Secret                  string   `json:"client_secret,omitempty"`
	Scope                   string   `json:"scope,omitempty"`
	GrantTypes              []string `json:"grant_types,omitempty"`
	Audience                []string `json:"audience,omitempty"`
	ResponseTypes           []string `json:"response_types,omitempty"`
	RedirectUris            []string `json:"redirect_uris,omitempty"`
	TokenEndpointAuthMethod string   `json:"token_endpoint_auth_method,omitempty"`
	PostLogoutRedirectUris  []string `json:"post_logout_redirect_uris,omitempty"`
}

type ConsentAcceptRequest

type ConsentAcceptRequest struct {
	Subject                  string               `json:"subject,omitempty"`
	GrantScope               []string             `json:"grant_scope"`
	GrantAccessTokenAudience []string             `json:"grant_access_token_audience,omitempty"`
	Session                  ConsentAcceptSession `json:"session" binding:"required"`
	Remember                 bool                 `json:"remember" binding:"required"`
	RememberFor              int                  `json:"remember_for" binding:"required"`
}

type ConsentAcceptResponse

type ConsentAcceptResponse struct {
	RedirectTo string `json:"redirect_to"`
}

func AcceptConsent

func AcceptConsent(url string, client *HydraClient, challenge string, hydraConsentAcceptRequest ConsentAcceptRequest) (ConsentAcceptResponse, error)

config.Hydra.ConsentRequestAcceptUrl

type ConsentAcceptSession

type ConsentAcceptSession struct {
	AccessToken string `json:"access_token,omitempty"`
	IdToken     string `json:"id_token,omitempty"`
}

type ConsentRejectRequest

type ConsentRejectRequest struct {
	Error            string `json:"error"`
	ErrorDebug       string `json:"error_debug"`
	ErrorDescription string `json:"error_description"`
	ErrorHint        string `json:"error_hint"`
	StatusCode       int    `json:"status_code"`
}

type ConsentRejectResponse

type ConsentRejectResponse struct {
	RedirectTo string `json:"redirect_to"`
}

func RejectConsent

func RejectConsent(url string, client *HydraClient, challenge string, hydraConsentRejectRequest ConsentRejectRequest) (ConsentRejectResponse, error)

config.Hydra.ConsentRequestRejectUrl

type ConsentResponse

type ConsentResponse struct {
	Subject                      string            `json:"subject"`
	Skip                         bool              `json:"skip"`
	RedirectTo                   string            `json:"redirect_to"`
	GrantAccessTokenAudience     string            `json:"grant_access_token_audience"`
	RequestUrl                   string            `json:"request_url"`
	RequestedAccessTokenAudience []string          `json:"requested_access_token_audience"`
	RequestedScopes              []string          `json:"requested_scope"`
	Client                       Oauth2Client      `json:"client"`
	Context                      map[string]string `json:"context"`
}

func GetConsent

func GetConsent(url string, client *HydraClient, challenge string) (ConsentResponse, error)

config.Hydra.ConsentRequestUrl

type CreateClientRequest

type CreateClientRequest Client

type CreateClientResponse

type CreateClientResponse Client

func CreateClient

func CreateClient(url string, createClientRequest CreateClientRequest) (createClientResponse CreateClientResponse, err error)

type DeleteLoginSessionRequest

type DeleteLoginSessionRequest struct {
	Subject string `json:"subject"`
}

type DeleteLoginSessionResponse

type DeleteLoginSessionResponse struct {
	Debug            string `json:"debug"`
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
	StatusCode       int64  `json:"status_code"`
}

SESSION STRUCT BEGIN

func DeleteLoginSessions

func DeleteLoginSessions(url string, client *HydraClient, deleteLoginSessionsRequest DeleteLoginSessionRequest) (DeleteLoginSessionResponse, error)

SESSION FUNC BEGIN config.Hydra.LogoutRequestAcceptUrl

type HydraClient

type HydraClient struct {
	*http.Client
}

func NewHydraClient

func NewHydraClient(config *clientcredentials.Config) *HydraClient

type IntrospectRequest

type IntrospectRequest struct {
	Token string `json:"token"`
	Scope string `json:"scope"`
}

type IntrospectResponse

type IntrospectResponse struct {
	Active   bool     `json:"active"`
	Aud      []string `json:"aud"`
	ClientId string   `json:"client_id"`
	Exp      int64    `json:"exp"`

	Iat               int64  `json:"iat"`
	Iss               string `json:"iss"`
	Nbf               int64  `json:"nbf"`
	ObfuscatedSubject string `json:"obfuscated_subject"`
	Scope             string `json:"scope"`
	Sub               string `json:"sub"`
	TokenType         string `json:"token_type"`
	Username          string `json:"username"`
}

https://www.ory.sh/docs/hydra/sdk/api#schemaoauth2tokenintrospection

func IntrospectToken

func IntrospectToken(introspectUrl string, client *HydraClient, introspectRequest IntrospectRequest) (IntrospectResponse, error)

type LoginAcceptRequest

type LoginAcceptRequest struct {
	Subject     string            `json:"subject" validate:"required"`
	Remember    bool              `json:"remember,omitempty"`
	RememberFor int               `json:"remember_for,omitempty"`
	ACR         string            `json:"acr,omitempty"`
	Context     map[string]string `json:"context,omitempty"`
}

type LoginAcceptResponse

type LoginAcceptResponse struct {
	RedirectTo string `json:"redirect_to"`
}

func AcceptLogin

func AcceptLogin(url string, client *HydraClient, challenge string, hydraLoginAcceptRequest LoginAcceptRequest) (LoginAcceptResponse, error)

config.Hydra.LoginRequestAcceptUrl

type LoginRejectRequest

type LoginRejectRequest struct {
	Error            string `json:"error,omitempty"`
	ErrorDebug       string `json:"error_debug,omitempty"`
	ErrorDescription string `json:"error_description,omitempty"`
	ErrorHint        string `json:"error_hint,omitempty"`
	StatusCode       int64  `json:"status_code,omitempty"`
}

type LoginRejectResponse

type LoginRejectResponse struct {
	RedirectTo string `json:"redirect_to"`
}

func RejectLogin

func RejectLogin(url string, client *HydraClient, challenge string, hydraLoginAcceptRequest LoginRejectRequest) (hydraLoginRejectResponse LoginRejectResponse, err error)

config.Hydra.LoginRequestRejectUrl

type LoginResponse

type LoginResponse struct {
	Skip       bool         `json:"skip"`
	RedirectTo string       `json:"redirect_to"`
	Subject    string       `json:"subject"`
	Client     Oauth2Client `json:"client"`
}

func GetLogin

func GetLogin(url string, client *HydraClient, challenge string) (LoginResponse, error)

config.Hydra.LoginRequestUrl

type LogoutAcceptRequest

type LogoutAcceptRequest struct {
}

type LogoutAcceptResponse

type LogoutAcceptResponse struct {
	RedirectTo string `json:"redirect_to"`
}

func AcceptLogout

func AcceptLogout(url string, client *HydraClient, challenge string, hydraLogoutAcceptRequest LogoutAcceptRequest) (LogoutAcceptResponse, error)

config.Hydra.LogoutRequestAcceptUrl

type LogoutResponse

type LogoutResponse struct {
	RequestUrl  string `json:"request_url"`
	RpInitiated bool   `json:"rp_initiated"`
	Sid         string `json:"sid"`
	Subject     string `json:"subject"`
}

func GetLogout

func GetLogout(url string, client *HydraClient, challenge string) (LogoutResponse, error)

config.Hydra.LogoutRequestUrl

type Oauth2Client

type Oauth2Client struct {
	ClientId string `form:"client_id" json:"client_id,omitempty"`
}

OAuth2 Client BEGIN

type ReadClientResponse

type ReadClientResponse Client

func ReadClient

func ReadClient(url string, client_id string) (readClientResponse ReadClientResponse, err error)

type UpdateClientRequest

type UpdateClientRequest Client

type UpdateClientResponse

type UpdateClientResponse Client

func UpdateClient

func UpdateClient(url string, client_id string, updateClientRequest UpdateClientRequest) (updateClientResponse UpdateClientResponse, err error)

type UserInfoResponse

type UserInfoResponse struct {
	Sub string `json:"sub"`
}

func GetUserInfo

func GetUserInfo(url string, client *HydraClient) (UserInfoResponse, error)

config.Hydra.UserInfoUrl

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL