diff --git a/consent/doc.go b/consent/doc.go
index b88594f728f..9fcd33b0dfe 100644
--- a/consent/doc.go
+++ b/consent/doc.go
@@ -45,6 +45,13 @@ type swaggerRevokeUserClientConsentSessionsPayload struct {
Client string `json:"client"`
}
+// swagger:parameters listUserConsentSessions
+type swaggerListUserConsentSessionsPayload struct {
+ // in: path
+ // required: true
+ User string `json:"user"`
+}
+
// swagger:parameters revokeAuthenticationSession
type swaggerRevokeAuthenticationSessionPayload struct {
// in: path
@@ -81,3 +88,11 @@ type swaggerRejectRequest struct {
// in: body
Body RequestDeniedError
}
+
+// A list of handled consent requests.
+// swagger:response handledConsentRequestList
+type swaggerListHandledConsentRequestsResult struct {
+ // in: body
+ // type: array
+ Body []PreviousConsentSession
+}
diff --git a/consent/handler.go b/consent/handler.go
index c8d8772d2f3..20a0942b746 100644
--- a/consent/handler.go
+++ b/consent/handler.go
@@ -30,6 +30,8 @@ import (
"github.com/ory/fosite"
"github.com/ory/go-convenience/urlx"
"github.com/ory/herodot"
+ "github.com/ory/pagination"
+ "github.com/ory/sqlcon"
"github.com/pkg/errors"
)
@@ -64,6 +66,7 @@ func (h *Handler) SetRoutes(r *httprouter.Router) {
r.PUT(ConsentPath+"/:challenge/reject", h.RejectConsentRequest)
r.DELETE("/oauth2/auth/sessions/login/:user", h.DeleteLoginSession)
+ r.GET("/oauth2/auth/sessions/consent/:user", h.GetConsentSessions)
r.DELETE("/oauth2/auth/sessions/consent/:user", h.DeleteUserConsentSession)
r.DELETE("/oauth2/auth/sessions/consent/:user/:client", h.DeleteUserClientConsentSession)
}
@@ -133,6 +136,58 @@ func (h *Handler) DeleteUserClientConsentSession(w http.ResponseWriter, r *http.
w.WriteHeader(http.StatusNoContent)
}
+// swagger:route GET /oauth2/auth/sessions/consent/{user} oAuth2 listUserConsentSessions
+//
+// Lists all consent sessions of a user
+//
+// This endpoint lists all user's granted consent sessions, including client and granted scope
+//
+// Consumes:
+// - application/json
+//
+// Produces:
+// - application/json
+//
+// Schemes: http, https
+//
+// Responses:
+// 200: handledConsentRequestList
+// 401: genericError
+// 403: genericError
+// 500: genericError
+
+func (h *Handler) GetConsentSessions(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
+ user := ps.ByName("user")
+ if user == "" {
+ h.H.WriteError(w, r, errors.WithStack(fosite.ErrInvalidRequest.WithDebug("Parameter user is not defined")))
+ return
+ }
+ limit, offset := pagination.Parse(r, 100, 0, 500)
+
+ sessions, err := h.M.FindPreviouslyGrantedConsentRequestsByUser(user, limit, offset)
+
+ if err == sqlcon.ErrNoRows {
+ h.H.Write(w, r, []PreviousConsentSession{})
+ return
+ } else if err != nil {
+ h.H.WriteError(w, r, err)
+ return
+ }
+
+ var a []PreviousConsentSession
+
+ for _, session := range sessions {
+ session.ConsentRequest.Client = sanitizeClient(session.ConsentRequest.Client)
+ a = append(a, PreviousConsentSession(session))
+ }
+
+ if len(a) == 0 {
+ a = []PreviousConsentSession{}
+ }
+
+ h.H.Write(w, r, a)
+}
+
// swagger:route DELETE /oauth2/auth/sessions/login/{user} oAuth2 revokeAuthenticationSession
//
// Invalidates a user's authentication session
diff --git a/consent/manager.go b/consent/manager.go
index 9429ca58e7e..2e9fd37ee42 100644
--- a/consent/manager.go
+++ b/consent/manager.go
@@ -29,6 +29,7 @@ type Manager interface {
VerifyAndInvalidateConsentRequest(verifier string) (*HandledConsentRequest, error)
FindPreviouslyGrantedConsentRequests(client string, user string) ([]HandledConsentRequest, error)
+ FindPreviouslyGrantedConsentRequestsByUser(user string, limit, offset int) ([]HandledConsentRequest, error)
// Cookie management
GetAuthenticationSession(id string) (*AuthenticationSession, error)
diff --git a/consent/manager_memory.go b/consent/manager_memory.go
index 02784458615..94572db50b9 100644
--- a/consent/manager_memory.go
+++ b/consent/manager_memory.go
@@ -26,6 +26,7 @@ import (
"github.com/ory/fosite"
"github.com/ory/hydra/pkg"
+ "github.com/ory/pagination"
"github.com/pkg/errors"
)
@@ -162,6 +163,25 @@ func (m *MemoryManager) VerifyAndInvalidateConsentRequest(verifier string) (*Han
}
func (m *MemoryManager) FindPreviouslyGrantedConsentRequests(client string, subject string) ([]HandledConsentRequest, error) {
+ var rs []HandledConsentRequest
+ filteredByUser, err := m.FindPreviouslyGrantedConsentRequestsByUser(subject, -1, -1)
+ if err != nil {
+ return nil, err
+ }
+
+ for _, c := range filteredByUser {
+ if client == c.ConsentRequest.Client.GetID() {
+ rs = append(rs, c)
+ }
+ }
+ if len(rs) == 0 {
+ return []HandledConsentRequest{}, nil
+ }
+
+ return rs, nil
+}
+
+func (m *MemoryManager) FindPreviouslyGrantedConsentRequestsByUser(subject string, limit, offset int) ([]HandledConsentRequest, error) {
var rs []HandledConsentRequest
for _, c := range m.handledConsentRequests {
cr, err := m.GetConsentRequest(c.Challenge)
@@ -171,10 +191,6 @@ func (m *MemoryManager) FindPreviouslyGrantedConsentRequests(client string, subj
return nil, err
}
- if client != cr.Client.GetID() {
- continue
- }
-
if subject != cr.Subject {
continue
}
@@ -203,7 +219,12 @@ func (m *MemoryManager) FindPreviouslyGrantedConsentRequests(client string, subj
return []HandledConsentRequest{}, nil
}
- return rs, nil
+ if limit < 0 && offset < 0 {
+ return rs, nil
+ }
+
+ start, end := pagination.Index(limit, offset, len(rs))
+ return rs[start:end], nil
}
func (m *MemoryManager) GetAuthenticationSession(id string) (*AuthenticationSession, error) {
diff --git a/consent/manager_sql.go b/consent/manager_sql.go
index 35a4706a4ad..9abc08551e0 100644
--- a/consent/manager_sql.go
+++ b/consent/manager_sql.go
@@ -364,8 +364,31 @@ WHERE
return nil, sqlcon.HandleError(err)
}
+ return m.resolveHandledConsentRequests(a)
+}
+
+func (m *SQLManager) FindPreviouslyGrantedConsentRequestsByUser(subject string, limit, offset int) ([]HandledConsentRequest, error) {
+ var a []sqlHandledConsentRequest
+
+ if err := m.db.Select(&a, m.db.Rebind(`SELECT h.* FROM
+ hydra_oauth2_consent_request_handled as h
+JOIN
+ hydra_oauth2_consent_request as r ON (h.challenge = r.challenge)
+WHERE
+ r.subject=? AND r.skip=FALSE
+ AND
+ (h.error='{}' AND h.remember=TRUE)
+LIMIT ? OFFSET ?
+`), subject, limit, offset); err != nil {
+ return nil, sqlcon.HandleError(err)
+ }
+
+ return m.resolveHandledConsentRequests(a)
+}
+
+func (m *SQLManager) resolveHandledConsentRequests(requests []sqlHandledConsentRequest) ([]HandledConsentRequest, error) {
var aa []HandledConsentRequest
- for _, v := range a {
+ for _, v := range requests {
r, err := m.GetConsentRequest(v.Challenge)
if err != nil {
return nil, err
diff --git a/consent/manager_test.go b/consent/manager_test.go
index bfa5ef936b7..e7e45296f3a 100644
--- a/consent/manager_test.go
+++ b/consent/manager_test.go
@@ -485,6 +485,53 @@ func TestManagers(t *testing.T) {
})
}
})
+
+ t.Run("case=list-handled-consent-requests", func(t *testing.T) {
+ for k, m := range managers {
+ cr1, hcr1 := mockConsentRequest("rv1", true, 0, false, false, false)
+ cr2, hcr2 := mockConsentRequest("rv2", false, 0, false, false, false)
+ clientManager.CreateClient(cr1.Client)
+ clientManager.CreateClient(cr2.Client)
+
+ require.NoError(t, m.CreateConsentRequest(cr1))
+ require.NoError(t, m.CreateConsentRequest(cr2))
+ _, err := m.HandleConsentRequest("challengerv1", hcr1)
+ require.NoError(t, err)
+ _, err = m.HandleConsentRequest("challengerv2", hcr2)
+ require.NoError(t, err)
+
+ t.Run("manager="+k, func(t *testing.T) {
+ for i, tc := range []struct {
+ subject string
+ challenges []string
+ clients []string
+ }{
+ {
+ subject: "subjectrv1",
+ challenges: []string{"challengerv1"},
+ clients: []string{"clientrv1"},
+ },
+ {
+ subject: "subjectrv2",
+ challenges: []string{},
+ clients: []string{},
+ },
+ } {
+ t.Run(fmt.Sprintf("case=%d/subject=%s", i, tc.subject), func(t *testing.T) {
+ consents, _ := m.FindPreviouslyGrantedConsentRequestsByUser(tc.subject, 100, 0)
+
+ assert.Equal(t, len(tc.challenges), len(consents))
+
+ for _, consent := range consents {
+ assert.Contains(t, tc.challenges, consent.Challenge)
+ assert.Contains(t, tc.clients, consent.ConsentRequest.Client.ClientID)
+ }
+ })
+ }
+ })
+ }
+
+ })
}
func compareAuthenticationRequest(t *testing.T, a, b *AuthenticationRequest) {
diff --git a/consent/sdk_test.go b/consent/sdk_test.go
index 8790cddf9e6..383941962be 100644
--- a/consent/sdk_test.go
+++ b/consent/sdk_test.go
@@ -62,12 +62,16 @@ func TestSDK(t *testing.T) {
cr1, hcr1 := mockConsentRequest("1", false, 0, false, false, false)
cr2, hcr2 := mockConsentRequest("2", false, 0, false, false, false)
+ cr3, hcr3 := mockConsentRequest("3", true, 3600, false, false, false)
require.NoError(t, m.CreateConsentRequest(cr1))
require.NoError(t, m.CreateConsentRequest(cr2))
+ require.NoError(t, m.CreateConsentRequest(cr3))
_, err = m.HandleConsentRequest("challenge1", hcr1)
require.NoError(t, err)
_, err = m.HandleConsentRequest("challenge2", hcr2)
require.NoError(t, err)
+ _, err = m.HandleConsentRequest("challenge3", hcr3)
+ require.NoError(t, err)
crGot, res, err := sdk.GetConsentRequest("challenge1")
require.NoError(t, err)
@@ -113,6 +117,18 @@ func TestSDK(t *testing.T) {
_, res, err = sdk.GetConsentRequest("challenge2")
require.NoError(t, err)
require.EqualValues(t, http.StatusNotFound, res.StatusCode)
+
+ csGot, res, err := sdk.ListUserConsentSessions("subject3")
+ require.NoError(t, err)
+ require.EqualValues(t, http.StatusOK, res.StatusCode)
+ assert.Equal(t, 1, len(csGot))
+ cs := csGot[0]
+ assert.Equal(t, "challenge3", cs.ConsentRequest.Challenge)
+
+ csGot, res, err = sdk.ListUserConsentSessions("subject2")
+ require.NoError(t, err)
+ require.EqualValues(t, http.StatusOK, res.StatusCode)
+ assert.Equal(t, 0, len(csGot))
}
func compareSDKLoginRequest(t *testing.T, expected *AuthenticationRequest, got *swagger.LoginRequest) {
diff --git a/consent/types.go b/consent/types.go
index f7d7f4ebfc1..96883b24bb0 100644
--- a/consent/types.go
+++ b/consent/types.go
@@ -104,6 +104,31 @@ type HandledConsentRequest struct {
WasUsed bool `json:"-"`
}
+// The response used to return handled consent requests
+// same as HandledAuthenticationRequest, just with consent_request exposed as json
+type PreviousConsentSession struct {
+ // GrantScope sets the scope the user authorized the client to use. Should be a subset of `requested_scope`
+ GrantedScope []string `json:"grant_scope"`
+
+ // Session allows you to set (optional) session data for access and ID tokens.
+ Session *ConsentRequestSessionData `json:"session"`
+
+ // Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same
+ // client asks the same user for the same, or a subset of, scope.
+ Remember bool `json:"remember"`
+
+ // RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the
+ // authorization will be remembered indefinitely.
+ RememberFor int `json:"remember_for"`
+
+ ConsentRequest *ConsentRequest `json:"consent_request"`
+ Error *RequestDeniedError `json:"-"`
+ Challenge string `json:"-"`
+ RequestedAt time.Time `json:"-"`
+ AuthenticatedAt time.Time `json:"-"`
+ WasUsed bool `json:"-"`
+}
+
// The request payload used to accept a login request.
//
// swagger:model acceptLoginRequest
diff --git a/docs/api.swagger.json b/docs/api.swagger.json
index eff6f931bdd..063e404686f 100644
--- a/docs/api.swagger.json
+++ b/docs/api.swagger.json
@@ -1064,6 +1064,47 @@
}
},
"/oauth2/auth/sessions/consent/{user}": {
+ "get": {
+ "description": "This endpoint lists all user's granted consent sessions, including client and granted scope",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "schemes": [
+ "http",
+ "https"
+ ],
+ "tags": [
+ "oAuth2"
+ ],
+ "summary": "Lists all consent sessions of a user",
+ "operationId": "listUserConsentSessions",
+ "parameters": [
+ {
+ "type": "string",
+ "x-go-name": "User",
+ "name": "user",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/handledConsentRequestList"
+ },
+ "401": {
+ "$ref": "#/responses/genericError"
+ },
+ "403": {
+ "$ref": "#/responses/genericError"
+ },
+ "500": {
+ "$ref": "#/responses/genericError"
+ }
+ }
+ },
"delete": {
"description": "This endpoint revokes a user's granted consent sessions and invalidates all associated OAuth 2.0 Access Tokens.",
"consumes": [
@@ -1861,6 +1902,38 @@
},
"x-go-package": "encoding/asn1"
},
+ "PreviousConsentSession": {
+ "description": "The response used to return handled consent requests\nsame as HandledAuthenticationRequest, just with consent_request exposed as json",
+ "type": "object",
+ "properties": {
+ "consent_request": {
+ "$ref": "#/definitions/consentRequest"
+ },
+ "grant_scope": {
+ "description": "GrantScope sets the scope the user authorized the client to use. Should be a subset of `requested_scope`",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "GrantedScope"
+ },
+ "remember": {
+ "description": "Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same\nclient asks the same user for the same, or a subset of, scope.",
+ "type": "boolean",
+ "x-go-name": "Remember"
+ },
+ "remember_for": {
+ "description": "RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the\nauthorization will be remembered indefinitely.",
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "RememberFor"
+ },
+ "session": {
+ "$ref": "#/definitions/consentRequestSession"
+ }
+ },
+ "x-go-package": "github.com/ory/hydra/consent"
+ },
"PublicKeyAlgorithm": {
"type": "integer",
"format": "int64",
@@ -3015,6 +3088,15 @@
}
}
},
+ "handledConsentRequestList": {
+ "description": "A list of handled consent requests.",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/PreviousConsentSession"
+ }
+ }
+ },
"oAuth2ClientList": {
"description": "A list of clients.",
"schema": {
diff --git a/sdk/go/hydra/swagger/README.md b/sdk/go/hydra/swagger/README.md
index e30d04570fa..f86f6fdc272 100644
--- a/sdk/go/hydra/swagger/README.md
+++ b/sdk/go/hydra/swagger/README.md
@@ -43,6 +43,7 @@ Class | Method | HTTP request | Description
*OAuth2Api* | [**GetWellKnown**](docs/OAuth2Api.md#getwellknown) | **Get** /.well-known/openid-configuration | Server well known configuration
*OAuth2Api* | [**IntrospectOAuth2Token**](docs/OAuth2Api.md#introspectoauth2token) | **Post** /oauth2/introspect | Introspect OAuth2 tokens
*OAuth2Api* | [**ListOAuth2Clients**](docs/OAuth2Api.md#listoauth2clients) | **Get** /clients | List OAuth 2.0 Clients
+*OAuth2Api* | [**ListUserConsentSessions**](docs/OAuth2Api.md#listuserconsentsessions) | **Get** /oauth2/auth/sessions/consent/{user} | Lists all consent sessions of a user
*OAuth2Api* | [**OauthAuth**](docs/OAuth2Api.md#oauthauth) | **Get** /oauth2/auth | The OAuth 2.0 authorize endpoint
*OAuth2Api* | [**OauthToken**](docs/OAuth2Api.md#oauthtoken) | **Post** /oauth2/token | The OAuth 2.0 token endpoint
*OAuth2Api* | [**RejectConsentRequest**](docs/OAuth2Api.md#rejectconsentrequest) | **Put** /oauth2/auth/requests/consent/{challenge}/reject | Reject an consent request
@@ -89,6 +90,7 @@ Class | Method | HTTP request | Description
- [OauthTokenResponse](docs/OauthTokenResponse.md)
- [ObjectIdentifier](docs/ObjectIdentifier.md)
- [OpenIdConnectContext](docs/OpenIdConnectContext.md)
+ - [PreviousConsentSession](docs/PreviousConsentSession.md)
- [PublicKeyAlgorithm](docs/PublicKeyAlgorithm.md)
- [RawMessage](docs/RawMessage.md)
- [RejectRequest](docs/RejectRequest.md)
diff --git a/sdk/go/hydra/swagger/docs/OAuth2Api.md b/sdk/go/hydra/swagger/docs/OAuth2Api.md
index 07ed4929810..5685b392d4f 100644
--- a/sdk/go/hydra/swagger/docs/OAuth2Api.md
+++ b/sdk/go/hydra/swagger/docs/OAuth2Api.md
@@ -15,6 +15,7 @@ Method | HTTP request | Description
[**GetWellKnown**](OAuth2Api.md#GetWellKnown) | **Get** /.well-known/openid-configuration | Server well known configuration
[**IntrospectOAuth2Token**](OAuth2Api.md#IntrospectOAuth2Token) | **Post** /oauth2/introspect | Introspect OAuth2 tokens
[**ListOAuth2Clients**](OAuth2Api.md#ListOAuth2Clients) | **Get** /clients | List OAuth 2.0 Clients
+[**ListUserConsentSessions**](OAuth2Api.md#ListUserConsentSessions) | **Get** /oauth2/auth/sessions/consent/{user} | Lists all consent sessions of a user
[**OauthAuth**](OAuth2Api.md#OauthAuth) | **Get** /oauth2/auth | The OAuth 2.0 authorize endpoint
[**OauthToken**](OAuth2Api.md#OauthToken) | **Post** /oauth2/token | The OAuth 2.0 token endpoint
[**RejectConsentRequest**](OAuth2Api.md#RejectConsentRequest) | **Put** /oauth2/auth/requests/consent/{challenge}/reject | Reject an consent request
@@ -348,6 +349,35 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+# **ListUserConsentSessions**
+> []PreviousConsentSession ListUserConsentSessions($user)
+
+Lists all consent sessions of a user
+
+This endpoint lists all user's granted consent sessions, including client and granted scope
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **user** | **string**| |
+
+### Return type
+
+[**[]PreviousConsentSession**](PreviousConsentSession.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
# **OauthAuth**
> OauthAuth()
diff --git a/sdk/go/hydra/swagger/docs/PreviousConsentSession.md b/sdk/go/hydra/swagger/docs/PreviousConsentSession.md
new file mode 100644
index 00000000000..45c36714cc1
--- /dev/null
+++ b/sdk/go/hydra/swagger/docs/PreviousConsentSession.md
@@ -0,0 +1,14 @@
+# PreviousConsentSession
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**ConsentRequest** | [**ConsentRequest**](consentRequest.md) | | [optional] [default to null]
+**GrantScope** | **[]string** | GrantScope sets the scope the user authorized the client to use. Should be a subset of `requested_scope` | [optional] [default to null]
+**Remember** | **bool** | Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope. | [optional] [default to null]
+**RememberFor** | **int64** | RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely. | [optional] [default to null]
+**Session** | [**ConsentRequestSession**](consentRequestSession.md) | | [optional] [default to null]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/sdk/go/hydra/swagger/o_auth2_api.go b/sdk/go/hydra/swagger/o_auth2_api.go
index aaf9c4886d2..5d21650cbf9 100644
--- a/sdk/go/hydra/swagger/o_auth2_api.go
+++ b/sdk/go/hydra/swagger/o_auth2_api.go
@@ -724,6 +724,67 @@ func (a OAuth2Api) ListOAuth2Clients(limit int64, offset int64) ([]OAuth2Client,
return *successPayload, localVarAPIResponse, err
}
+/**
+ * Lists all consent sessions of a user
+ * This endpoint lists all user's granted consent sessions, including client and granted scope
+ *
+ * @param user
+ * @return []PreviousConsentSession
+ */
+func (a OAuth2Api) ListUserConsentSessions(user string) ([]PreviousConsentSession, *APIResponse, error) {
+
+ var localVarHttpMethod = strings.ToUpper("Get")
+ // create path and map variables
+ localVarPath := a.Configuration.BasePath + "/oauth2/auth/sessions/consent/{user}"
+ localVarPath = strings.Replace(localVarPath, "{"+"user"+"}", fmt.Sprintf("%v", user), -1)
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := make(map[string]string)
+ var localVarPostBody interface{}
+ var localVarFileName string
+ var localVarFileBytes []byte
+ // add default headers if any
+ for key := range a.Configuration.DefaultHeader {
+ localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
+ }
+
+ // to determine the Content-Type header
+ localVarHttpContentTypes := []string{"application/json"}
+
+ // set Content-Type header
+ localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
+ if localVarHttpContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHttpContentType
+ }
+ // to determine the Accept header
+ localVarHttpHeaderAccepts := []string{
+ "application/json",
+ }
+
+ // set Accept header
+ localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
+ if localVarHttpHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
+ }
+ var successPayload = new([]PreviousConsentSession)
+ localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
+
+ var localVarURL, _ = url.Parse(localVarPath)
+ localVarURL.RawQuery = localVarQueryParams.Encode()
+ var localVarAPIResponse = &APIResponse{Operation: "ListUserConsentSessions", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
+ if localVarHttpResponse != nil {
+ localVarAPIResponse.Response = localVarHttpResponse.RawResponse
+ localVarAPIResponse.Payload = localVarHttpResponse.Body()
+ }
+
+ if err != nil {
+ return *successPayload, localVarAPIResponse, err
+ }
+ err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)
+ return *successPayload, localVarAPIResponse, err
+}
+
/**
* The OAuth 2.0 authorize endpoint
* This endpoint is not documented here because you should never use your own implementation to perform OAuth2 flows. OAuth2 is a very popular protocol and a library for your programming language will exists. To learn more about this flow please refer to the specification: https://tools.ietf.org/html/rfc6749
diff --git a/sdk/go/hydra/swagger/previous_consent_session.go b/sdk/go/hydra/swagger/previous_consent_session.go
new file mode 100644
index 00000000000..ceea23aa638
--- /dev/null
+++ b/sdk/go/hydra/swagger/previous_consent_session.go
@@ -0,0 +1,27 @@
+/*
+ * ORY Hydra - Cloud Native OAuth 2.0 and OpenID Connect Server
+ *
+ * Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. Keep in mind that this document reflects the latest branch, always. Support for versioned documentation is coming in the future.
+ *
+ * OpenAPI spec version: Latest
+ * Contact: hi@ory.am
+ * Generated by: https://github.com/swagger-api/swagger-codegen.git
+ */
+
+package swagger
+
+// The response used to return handled consent requests same as HandledAuthenticationRequest, just with consent_request exposed as json
+type PreviousConsentSession struct {
+ ConsentRequest ConsentRequest `json:"consent_request,omitempty"`
+
+ // GrantScope sets the scope the user authorized the client to use. Should be a subset of `requested_scope`
+ GrantScope []string `json:"grant_scope,omitempty"`
+
+ // Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope.
+ Remember bool `json:"remember,omitempty"`
+
+ // RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely.
+ RememberFor int64 `json:"remember_for,omitempty"`
+
+ Session ConsentRequestSession `json:"session,omitempty"`
+}
diff --git a/sdk/js/swagger/README.md b/sdk/js/swagger/README.md
index f6e46cc2aee..0bb6c8b8f92 100644
--- a/sdk/js/swagger/README.md
+++ b/sdk/js/swagger/README.md
@@ -136,6 +136,7 @@ Class | Method | HTTP request | Description
*OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Api* | [**getWellKnown**](docs/OAuth2Api.md#getWellKnown) | **GET** /.well-known/openid-configuration | Server well known configuration
*OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Api* | [**introspectOAuth2Token**](docs/OAuth2Api.md#introspectOAuth2Token) | **POST** /oauth2/introspect | Introspect OAuth2 tokens
*OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Api* | [**listOAuth2Clients**](docs/OAuth2Api.md#listOAuth2Clients) | **GET** /clients | List OAuth 2.0 Clients
+*OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Api* | [**listUserConsentSessions**](docs/OAuth2Api.md#listUserConsentSessions) | **GET** /oauth2/auth/sessions/consent/{user} | Lists all consent sessions of a user
*OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Api* | [**oauthAuth**](docs/OAuth2Api.md#oauthAuth) | **GET** /oauth2/auth | The OAuth 2.0 authorize endpoint
*OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Api* | [**oauthToken**](docs/OAuth2Api.md#oauthToken) | **POST** /oauth2/token | The OAuth 2.0 token endpoint
*OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Api* | [**rejectConsentRequest**](docs/OAuth2Api.md#rejectConsentRequest) | **PUT** /oauth2/auth/requests/consent/{challenge}/reject | Reject an consent request
@@ -184,6 +185,7 @@ Class | Method | HTTP request | Description
- [OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OauthTokenResponse](docs/OauthTokenResponse.md)
- [OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ObjectIdentifier](docs/ObjectIdentifier.md)
- [OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OpenIDConnectContext](docs/OpenIDConnectContext.md)
+ - [OryHydraCloudNativeOAuth20AndOpenIdConnectServer.PreviousConsentSession](docs/PreviousConsentSession.md)
- [OryHydraCloudNativeOAuth20AndOpenIdConnectServer.PublicKeyAlgorithm](docs/PublicKeyAlgorithm.md)
- [OryHydraCloudNativeOAuth20AndOpenIdConnectServer.RawMessage](docs/RawMessage.md)
- [OryHydraCloudNativeOAuth20AndOpenIdConnectServer.RejectRequest](docs/RejectRequest.md)
diff --git a/sdk/js/swagger/docs/JSONWebKey.md b/sdk/js/swagger/docs/JSONWebKey.md
new file mode 100644
index 00000000000..7bbc0c48051
--- /dev/null
+++ b/sdk/js/swagger/docs/JSONWebKey.md
@@ -0,0 +1,12 @@
+# OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JSONWebKey
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**algorithm** | **String** | | [optional]
+**certificates** | [**[Certificate]**](Certificate.md) | | [optional]
+**key** | **Object** | | [optional]
+**keyID** | **String** | | [optional]
+**use** | **String** | | [optional]
+
+
diff --git a/sdk/js/swagger/docs/JSONWebKeySet.md b/sdk/js/swagger/docs/JSONWebKeySet.md
new file mode 100644
index 00000000000..15db72104b1
--- /dev/null
+++ b/sdk/js/swagger/docs/JSONWebKeySet.md
@@ -0,0 +1,8 @@
+# OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JSONWebKeySet
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**keys** | [**[JSONWebKey]**](JSONWebKey.md) | | [optional]
+
+
diff --git a/sdk/js/swagger/docs/OAuth2Api.md b/sdk/js/swagger/docs/OAuth2Api.md
index f5b2c7be4ad..860c7c6eb9c 100644
--- a/sdk/js/swagger/docs/OAuth2Api.md
+++ b/sdk/js/swagger/docs/OAuth2Api.md
@@ -15,6 +15,7 @@ Method | HTTP request | Description
[**getWellKnown**](OAuth2Api.md#getWellKnown) | **GET** /.well-known/openid-configuration | Server well known configuration
[**introspectOAuth2Token**](OAuth2Api.md#introspectOAuth2Token) | **POST** /oauth2/introspect | Introspect OAuth2 tokens
[**listOAuth2Clients**](OAuth2Api.md#listOAuth2Clients) | **GET** /clients | List OAuth 2.0 Clients
+[**listUserConsentSessions**](OAuth2Api.md#listUserConsentSessions) | **GET** /oauth2/auth/sessions/consent/{user} | Lists all consent sessions of a user
[**oauthAuth**](OAuth2Api.md#oauthAuth) | **GET** /oauth2/auth | The OAuth 2.0 authorize endpoint
[**oauthToken**](OAuth2Api.md#oauthToken) | **POST** /oauth2/token | The OAuth 2.0 token endpoint
[**rejectConsentRequest**](OAuth2Api.md#rejectConsentRequest) | **PUT** /oauth2/auth/requests/consent/{challenge}/reject | Reject an consent request
@@ -549,6 +550,52 @@ Name | Type | Description | Notes
No authorization required
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+
+# **listUserConsentSessions**
+> [PreviousConsentSession] listUserConsentSessions(user)
+
+Lists all consent sessions of a user
+
+This endpoint lists all user's granted consent sessions, including client and granted scope
+
+### Example
+```javascript
+var OryHydraCloudNativeOAuth20AndOpenIdConnectServer = require('ory_hydra___cloud_native_o_auth_20_and_open_id_connect_server');
+
+var apiInstance = new OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OAuth2Api();
+
+var user = "user_example"; // String |
+
+
+var callback = function(error, data, response) {
+ if (error) {
+ console.error(error);
+ } else {
+ console.log('API called successfully. Returned data: ' + data);
+ }
+};
+apiInstance.listUserConsentSessions(user, callback);
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **user** | **String**| |
+
+### Return type
+
+[**[PreviousConsentSession]**](PreviousConsentSession.md)
+
+### Authorization
+
+No authorization required
+
### HTTP request headers
- **Content-Type**: application/json
diff --git a/sdk/js/swagger/docs/PreviousConsentSession.md b/sdk/js/swagger/docs/PreviousConsentSession.md
new file mode 100644
index 00000000000..a17eed04ffe
--- /dev/null
+++ b/sdk/js/swagger/docs/PreviousConsentSession.md
@@ -0,0 +1,12 @@
+# OryHydraCloudNativeOAuth20AndOpenIdConnectServer.PreviousConsentSession
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**consentRequest** | [**ConsentRequest**](ConsentRequest.md) | | [optional]
+**grantScope** | **[String]** | GrantScope sets the scope the user authorized the client to use. Should be a subset of `requested_scope` | [optional]
+**remember** | **Boolean** | Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope. | [optional]
+**rememberFor** | **Number** | RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely. | [optional]
+**session** | [**ConsentRequestSession**](ConsentRequestSession.md) | | [optional]
+
+
diff --git a/sdk/js/swagger/src/api/OAuth2Api.js b/sdk/js/swagger/src/api/OAuth2Api.js
index f51bba5ee52..8840704757b 100644
--- a/sdk/js/swagger/src/api/OAuth2Api.js
+++ b/sdk/js/swagger/src/api/OAuth2Api.js
@@ -30,6 +30,7 @@
'model/OAuth2Client',
'model/OAuth2TokenIntrospection',
'model/OauthTokenResponse',
+ 'model/PreviousConsentSession',
'model/RejectRequest',
'model/UserinfoResponse',
'model/WellKnown'
@@ -49,6 +50,7 @@
require('../model/OAuth2Client'),
require('../model/OAuth2TokenIntrospection'),
require('../model/OauthTokenResponse'),
+ require('../model/PreviousConsentSession'),
require('../model/RejectRequest'),
require('../model/UserinfoResponse'),
require('../model/WellKnown')
@@ -74,6 +76,8 @@
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer
.OAuth2TokenIntrospection,
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.OauthTokenResponse,
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer
+ .PreviousConsentSession,
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.RejectRequest,
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.UserinfoResponse,
root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.WellKnown
@@ -92,6 +96,7 @@
OAuth2Client,
OAuth2TokenIntrospection,
OauthTokenResponse,
+ PreviousConsentSession,
RejectRequest,
UserinfoResponse,
WellKnown
@@ -686,6 +691,59 @@
)
}
+ /**
+ * Callback function to receive the result of the listUserConsentSessions operation.
+ * @callback module:api/OAuth2Api~listUserConsentSessionsCallback
+ * @param {String} error Error message, if any.
+ * @param {Array.} data The data returned by the service call.
+ * @param {String} response The complete HTTP response.
+ */
+
+ /**
+ * Lists all consent sessions of a user
+ * This endpoint lists all user's granted consent sessions, including client and granted scope
+ * @param {String} user
+ * @param {module:api/OAuth2Api~listUserConsentSessionsCallback} callback The callback function, accepting three arguments: error, data, response
+ * data is of type: {@link Array.}
+ */
+ this.listUserConsentSessions = function(user, callback) {
+ var postBody = null
+
+ // verify the required parameter 'user' is set
+ if (user === undefined || user === null) {
+ throw new Error(
+ "Missing the required parameter 'user' when calling listUserConsentSessions"
+ )
+ }
+
+ var pathParams = {
+ user: user
+ }
+ var queryParams = {}
+ var headerParams = {}
+ var formParams = {}
+
+ var authNames = []
+ var contentTypes = ['application/json']
+ var accepts = ['application/json']
+ var returnType = [PreviousConsentSession]
+
+ return this.apiClient.callApi(
+ '/oauth2/auth/sessions/consent/{user}',
+ 'GET',
+ pathParams,
+ queryParams,
+ headerParams,
+ formParams,
+ postBody,
+ authNames,
+ contentTypes,
+ accepts,
+ returnType,
+ callback
+ )
+ }
+
/**
* Callback function to receive the result of the oauthAuth operation.
* @callback module:api/OAuth2Api~oauthAuthCallback
diff --git a/sdk/js/swagger/src/index.js b/sdk/js/swagger/src/index.js
index 693ce707a07..0724b6b472f 100644
--- a/sdk/js/swagger/src/index.js
+++ b/sdk/js/swagger/src/index.js
@@ -51,6 +51,7 @@
'model/OauthTokenResponse',
'model/ObjectIdentifier',
'model/OpenIDConnectContext',
+ 'model/PreviousConsentSession',
'model/PublicKeyAlgorithm',
'model/RawMessage',
'model/RejectRequest',
@@ -110,6 +111,7 @@
require('./model/OauthTokenResponse'),
require('./model/ObjectIdentifier'),
require('./model/OpenIDConnectContext'),
+ require('./model/PreviousConsentSession'),
require('./model/PublicKeyAlgorithm'),
require('./model/RawMessage'),
require('./model/RejectRequest'),
@@ -168,6 +170,7 @@
OauthTokenResponse,
ObjectIdentifier,
OpenIDConnectContext,
+ PreviousConsentSession,
PublicKeyAlgorithm,
RawMessage,
RejectRequest,
@@ -390,6 +393,11 @@
* @property {module:model/OpenIDConnectContext}
*/
OpenIDConnectContext: OpenIDConnectContext,
+ /**
+ * The PreviousConsentSession model constructor.
+ * @property {module:model/PreviousConsentSession}
+ */
+ PreviousConsentSession: PreviousConsentSession,
/**
* The PublicKeyAlgorithm model constructor.
* @property {module:model/PublicKeyAlgorithm}
diff --git a/sdk/js/swagger/src/model/JSONWebKey.js b/sdk/js/swagger/src/model/JSONWebKey.js
new file mode 100644
index 00000000000..6738aca8f71
--- /dev/null
+++ b/sdk/js/swagger/src/model/JSONWebKey.js
@@ -0,0 +1,106 @@
+/**
+ * ORY Hydra - Cloud Native OAuth 2.0 and OpenID Connect Server
+ * Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. Keep in mind that this document reflects the latest branch, always. Support for versioned documentation is coming in the future.
+ *
+ * OpenAPI spec version: Latest
+ * Contact: hi@ory.am
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Swagger Codegen version: 2.2.3
+ *
+ * Do not edit the class manually.
+ *
+ */
+
+;(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['ApiClient', 'model/Certificate'], factory)
+ } else if (typeof module === 'object' && module.exports) {
+ // CommonJS-like environments that support module.exports, like Node.
+ module.exports = factory(require('../ApiClient'), require('./Certificate'))
+ } else {
+ // Browser globals (root is window)
+ if (!root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer) {
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer = {}
+ }
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JSONWebKey = factory(
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ApiClient,
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.Certificate
+ )
+ }
+})(this, function(ApiClient, Certificate) {
+ 'use strict'
+
+ /**
+ * The JSONWebKey model module.
+ * @module model/JSONWebKey
+ * @version Latest
+ */
+
+ /**
+ * Constructs a new JSONWebKey
.
+ * @alias module:model/JSONWebKey
+ * @class
+ */
+ var exports = function() {
+ var _this = this
+ }
+
+ /**
+ * Constructs a JSONWebKey
from a plain JavaScript object, optionally creating a new instance.
+ * Copies all relevant properties from data
to obj
if supplied or a new instance if not.
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
+ * @param {module:model/JSONWebKey} obj Optional instance to populate.
+ * @return {module:model/JSONWebKey} The populated JSONWebKey
instance.
+ */
+ exports.constructFromObject = function(data, obj) {
+ if (data) {
+ obj = obj || new exports()
+
+ if (data.hasOwnProperty('Algorithm')) {
+ obj['Algorithm'] = ApiClient.convertToType(data['Algorithm'], 'String')
+ }
+ if (data.hasOwnProperty('Certificates')) {
+ obj['Certificates'] = ApiClient.convertToType(data['Certificates'], [
+ Certificate
+ ])
+ }
+ if (data.hasOwnProperty('Key')) {
+ obj['Key'] = ApiClient.convertToType(data['Key'], Object)
+ }
+ if (data.hasOwnProperty('KeyID')) {
+ obj['KeyID'] = ApiClient.convertToType(data['KeyID'], 'String')
+ }
+ if (data.hasOwnProperty('Use')) {
+ obj['Use'] = ApiClient.convertToType(data['Use'], 'String')
+ }
+ }
+ return obj
+ }
+
+ /**
+ * @member {String} Algorithm
+ */
+ exports.prototype['Algorithm'] = undefined
+ /**
+ * @member {Array.} Certificates
+ */
+ exports.prototype['Certificates'] = undefined
+ /**
+ * @member {Object} Key
+ */
+ exports.prototype['Key'] = undefined
+ /**
+ * @member {String} KeyID
+ */
+ exports.prototype['KeyID'] = undefined
+ /**
+ * @member {String} Use
+ */
+ exports.prototype['Use'] = undefined
+
+ return exports
+})
diff --git a/sdk/js/swagger/src/model/JSONWebKeySet.js b/sdk/js/swagger/src/model/JSONWebKeySet.js
new file mode 100644
index 00000000000..6b07a379fa6
--- /dev/null
+++ b/sdk/js/swagger/src/model/JSONWebKeySet.js
@@ -0,0 +1,76 @@
+/**
+ * ORY Hydra - Cloud Native OAuth 2.0 and OpenID Connect Server
+ * Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. Keep in mind that this document reflects the latest branch, always. Support for versioned documentation is coming in the future.
+ *
+ * OpenAPI spec version: Latest
+ * Contact: hi@ory.am
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Swagger Codegen version: 2.2.3
+ *
+ * Do not edit the class manually.
+ *
+ */
+
+;(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['ApiClient', 'model/JSONWebKey'], factory)
+ } else if (typeof module === 'object' && module.exports) {
+ // CommonJS-like environments that support module.exports, like Node.
+ module.exports = factory(require('../ApiClient'), require('./JSONWebKey'))
+ } else {
+ // Browser globals (root is window)
+ if (!root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer) {
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer = {}
+ }
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JSONWebKeySet = factory(
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ApiClient,
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.JSONWebKey
+ )
+ }
+})(this, function(ApiClient, JSONWebKey) {
+ 'use strict'
+
+ /**
+ * The JSONWebKeySet model module.
+ * @module model/JSONWebKeySet
+ * @version Latest
+ */
+
+ /**
+ * Constructs a new JSONWebKeySet
.
+ * @alias module:model/JSONWebKeySet
+ * @class
+ */
+ var exports = function() {
+ var _this = this
+ }
+
+ /**
+ * Constructs a JSONWebKeySet
from a plain JavaScript object, optionally creating a new instance.
+ * Copies all relevant properties from data
to obj
if supplied or a new instance if not.
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
+ * @param {module:model/JSONWebKeySet} obj Optional instance to populate.
+ * @return {module:model/JSONWebKeySet} The populated JSONWebKeySet
instance.
+ */
+ exports.constructFromObject = function(data, obj) {
+ if (data) {
+ obj = obj || new exports()
+
+ if (data.hasOwnProperty('keys')) {
+ obj['keys'] = ApiClient.convertToType(data['keys'], [JSONWebKey])
+ }
+ }
+ return obj
+ }
+
+ /**
+ * @member {Array.} keys
+ */
+ exports.prototype['keys'] = undefined
+
+ return exports
+})
diff --git a/sdk/js/swagger/src/model/PreviousConsentSession.js b/sdk/js/swagger/src/model/PreviousConsentSession.js
new file mode 100644
index 00000000000..4d3ca8a8cf7
--- /dev/null
+++ b/sdk/js/swagger/src/model/PreviousConsentSession.js
@@ -0,0 +1,127 @@
+/**
+ * ORY Hydra - Cloud Native OAuth 2.0 and OpenID Connect Server
+ * Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. Keep in mind that this document reflects the latest branch, always. Support for versioned documentation is coming in the future.
+ *
+ * OpenAPI spec version: Latest
+ * Contact: hi@ory.am
+ *
+ * NOTE: This class is auto generated by the swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen.git
+ *
+ * Swagger Codegen version: 2.2.3
+ *
+ * Do not edit the class manually.
+ *
+ */
+
+;(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define([
+ 'ApiClient',
+ 'model/ConsentRequest',
+ 'model/ConsentRequestSession'
+ ], factory)
+ } else if (typeof module === 'object' && module.exports) {
+ // CommonJS-like environments that support module.exports, like Node.
+ module.exports = factory(
+ require('../ApiClient'),
+ require('./ConsentRequest'),
+ require('./ConsentRequestSession')
+ )
+ } else {
+ // Browser globals (root is window)
+ if (!root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer) {
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer = {}
+ }
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.PreviousConsentSession = factory(
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ApiClient,
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer.ConsentRequest,
+ root.OryHydraCloudNativeOAuth20AndOpenIdConnectServer
+ .ConsentRequestSession
+ )
+ }
+})(this, function(ApiClient, ConsentRequest, ConsentRequestSession) {
+ 'use strict'
+
+ /**
+ * The PreviousConsentSession model module.
+ * @module model/PreviousConsentSession
+ * @version Latest
+ */
+
+ /**
+ * Constructs a new PreviousConsentSession
.
+ * The response used to return handled consent requests same as HandledAuthenticationRequest, just with consent_request exposed as json
+ * @alias module:model/PreviousConsentSession
+ * @class
+ */
+ var exports = function() {
+ var _this = this
+ }
+
+ /**
+ * Constructs a PreviousConsentSession
from a plain JavaScript object, optionally creating a new instance.
+ * Copies all relevant properties from data
to obj
if supplied or a new instance if not.
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
+ * @param {module:model/PreviousConsentSession} obj Optional instance to populate.
+ * @return {module:model/PreviousConsentSession} The populated PreviousConsentSession
instance.
+ */
+ exports.constructFromObject = function(data, obj) {
+ if (data) {
+ obj = obj || new exports()
+
+ if (data.hasOwnProperty('consent_request')) {
+ obj['consent_request'] = ConsentRequest.constructFromObject(
+ data['consent_request']
+ )
+ }
+ if (data.hasOwnProperty('grant_scope')) {
+ obj['grant_scope'] = ApiClient.convertToType(data['grant_scope'], [
+ 'String'
+ ])
+ }
+ if (data.hasOwnProperty('remember')) {
+ obj['remember'] = ApiClient.convertToType(data['remember'], 'Boolean')
+ }
+ if (data.hasOwnProperty('remember_for')) {
+ obj['remember_for'] = ApiClient.convertToType(
+ data['remember_for'],
+ 'Number'
+ )
+ }
+ if (data.hasOwnProperty('session')) {
+ obj['session'] = ConsentRequestSession.constructFromObject(
+ data['session']
+ )
+ }
+ }
+ return obj
+ }
+
+ /**
+ * @member {module:model/ConsentRequest} consent_request
+ */
+ exports.prototype['consent_request'] = undefined
+ /**
+ * GrantScope sets the scope the user authorized the client to use. Should be a subset of `requested_scope`
+ * @member {Array.} grant_scope
+ */
+ exports.prototype['grant_scope'] = undefined
+ /**
+ * Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope.
+ * @member {Boolean} remember
+ */
+ exports.prototype['remember'] = undefined
+ /**
+ * RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely.
+ * @member {Number} remember_for
+ */
+ exports.prototype['remember_for'] = undefined
+ /**
+ * @member {module:model/ConsentRequestSession} session
+ */
+ exports.prototype['session'] = undefined
+
+ return exports
+})
diff --git a/sdk/php/swagger/README.md b/sdk/php/swagger/README.md
index 38d522c36a7..84187648156 100644
--- a/sdk/php/swagger/README.md
+++ b/sdk/php/swagger/README.md
@@ -96,6 +96,7 @@ Class | Method | HTTP request | Description
*OAuth2Api* | [**getWellKnown**](docs/Api/OAuth2Api.md#getwellknown) | **GET** /.well-known/openid-configuration | Server well known configuration
*OAuth2Api* | [**introspectOAuth2Token**](docs/Api/OAuth2Api.md#introspectoauth2token) | **POST** /oauth2/introspect | Introspect OAuth2 tokens
*OAuth2Api* | [**listOAuth2Clients**](docs/Api/OAuth2Api.md#listoauth2clients) | **GET** /clients | List OAuth 2.0 Clients
+*OAuth2Api* | [**listUserConsentSessions**](docs/Api/OAuth2Api.md#listuserconsentsessions) | **GET** /oauth2/auth/sessions/consent/{user} | Lists all consent sessions of a user
*OAuth2Api* | [**oauthAuth**](docs/Api/OAuth2Api.md#oauthauth) | **GET** /oauth2/auth | The OAuth 2.0 authorize endpoint
*OAuth2Api* | [**oauthToken**](docs/Api/OAuth2Api.md#oauthtoken) | **POST** /oauth2/token | The OAuth 2.0 token endpoint
*OAuth2Api* | [**rejectConsentRequest**](docs/Api/OAuth2Api.md#rejectconsentrequest) | **PUT** /oauth2/auth/requests/consent/{challenge}/reject | Reject an consent request
@@ -144,6 +145,7 @@ Class | Method | HTTP request | Description
- [OauthTokenResponse](docs/Model/OauthTokenResponse.md)
- [ObjectIdentifier](docs/Model/ObjectIdentifier.md)
- [OpenIDConnectContext](docs/Model/OpenIDConnectContext.md)
+ - [PreviousConsentSession](docs/Model/PreviousConsentSession.md)
- [PublicKeyAlgorithm](docs/Model/PublicKeyAlgorithm.md)
- [RawMessage](docs/Model/RawMessage.md)
- [RejectRequest](docs/Model/RejectRequest.md)
diff --git a/sdk/php/swagger/docs/Api/OAuth2Api.md b/sdk/php/swagger/docs/Api/OAuth2Api.md
index b9b822059c8..73fea2de950 100644
--- a/sdk/php/swagger/docs/Api/OAuth2Api.md
+++ b/sdk/php/swagger/docs/Api/OAuth2Api.md
@@ -16,6 +16,7 @@ Method | HTTP request | Description
[**getWellKnown**](OAuth2Api.md#getWellKnown) | **GET** /.well-known/openid-configuration | Server well known configuration
[**introspectOAuth2Token**](OAuth2Api.md#introspectOAuth2Token) | **POST** /oauth2/introspect | Introspect OAuth2 tokens
[**listOAuth2Clients**](OAuth2Api.md#listOAuth2Clients) | **GET** /clients | List OAuth 2.0 Clients
+[**listUserConsentSessions**](OAuth2Api.md#listUserConsentSessions) | **GET** /oauth2/auth/sessions/consent/{user} | Lists all consent sessions of a user
[**oauthAuth**](OAuth2Api.md#oauthAuth) | **GET** /oauth2/auth | The OAuth 2.0 authorize endpoint
[**oauthToken**](OAuth2Api.md#oauthToken) | **POST** /oauth2/token | The OAuth 2.0 token endpoint
[**rejectConsentRequest**](OAuth2Api.md#rejectConsentRequest) | **PUT** /oauth2/auth/requests/consent/{challenge}/reject | Reject an consent request
@@ -532,6 +533,51 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
+# **listUserConsentSessions**
+> \Hydra\SDK\Model\PreviousConsentSession[] listUserConsentSessions($user)
+
+Lists all consent sessions of a user
+
+This endpoint lists all user's granted consent sessions, including client and granted scope
+
+### Example
+```php
+listUserConsentSessions($user);
+ print_r($result);
+} catch (Exception $e) {
+ echo 'Exception when calling OAuth2Api->listUserConsentSessions: ', $e->getMessage(), PHP_EOL;
+}
+?>
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **user** | **string**| |
+
+### Return type
+
+[**\Hydra\SDK\Model\PreviousConsentSession[]**](../Model/PreviousConsentSession.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
+
# **oauthAuth**
> oauthAuth()
diff --git a/sdk/php/swagger/docs/Model/JSONWebKey.md b/sdk/php/swagger/docs/Model/JSONWebKey.md
new file mode 100644
index 00000000000..d693ac2a666
--- /dev/null
+++ b/sdk/php/swagger/docs/Model/JSONWebKey.md
@@ -0,0 +1,14 @@
+# JSONWebKey
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**algorithm** | **string** | | [optional]
+**certificates** | [**\Hydra\SDK\Model\Certificate[]**](Certificate.md) | | [optional]
+**key** | **object** | | [optional]
+**key_id** | **string** | | [optional]
+**use** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/sdk/php/swagger/docs/Model/JSONWebKeySet.md b/sdk/php/swagger/docs/Model/JSONWebKeySet.md
new file mode 100644
index 00000000000..4d85289d79a
--- /dev/null
+++ b/sdk/php/swagger/docs/Model/JSONWebKeySet.md
@@ -0,0 +1,10 @@
+# JSONWebKeySet
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**keys** | [**\Hydra\SDK\Model\JSONWebKey[]**](JSONWebKey.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/sdk/php/swagger/docs/Model/PreviousConsentSession.md b/sdk/php/swagger/docs/Model/PreviousConsentSession.md
new file mode 100644
index 00000000000..54d9396ba25
--- /dev/null
+++ b/sdk/php/swagger/docs/Model/PreviousConsentSession.md
@@ -0,0 +1,14 @@
+# PreviousConsentSession
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**consent_request** | [**\Hydra\SDK\Model\ConsentRequest**](ConsentRequest.md) | | [optional]
+**grant_scope** | **string[]** | GrantScope sets the scope the user authorized the client to use. Should be a subset of `requested_scope` | [optional]
+**remember** | **bool** | Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope. | [optional]
+**remember_for** | **int** | RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely. | [optional]
+**session** | [**\Hydra\SDK\Model\ConsentRequestSession**](ConsentRequestSession.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/sdk/php/swagger/lib/Api/OAuth2Api.php b/sdk/php/swagger/lib/Api/OAuth2Api.php
index caf2d504649..47012e544b2 100644
--- a/sdk/php/swagger/lib/Api/OAuth2Api.php
+++ b/sdk/php/swagger/lib/Api/OAuth2Api.php
@@ -1127,6 +1127,104 @@ public function listOAuth2ClientsWithHttpInfo($limit = null, $offset = null)
}
}
+ /**
+ * Operation listUserConsentSessions
+ *
+ * Lists all consent sessions of a user
+ *
+ * Client for Hydra
+ *
+ * @param string $user (required)
+ * @throws \Hydra\SDK\ApiException on non-2xx response
+ * @return \Hydra\SDK\Model\PreviousConsentSession[]
+ */
+ public function listUserConsentSessions($user)
+ {
+ list($response) = $this->listUserConsentSessionsWithHttpInfo($user);
+ return $response;
+ }
+
+ /**
+ * Operation listUserConsentSessionsWithHttpInfo
+ *
+ * Lists all consent sessions of a user
+ *
+ * Client for Hydra
+ *
+ * @param string $user (required)
+ * @throws \Hydra\SDK\ApiException on non-2xx response
+ * @return array of \Hydra\SDK\Model\PreviousConsentSession[], HTTP status code, HTTP response headers (array of strings)
+ */
+ public function listUserConsentSessionsWithHttpInfo($user)
+ {
+ // verify the required parameter 'user' is set
+ if ($user === null) {
+ throw new \InvalidArgumentException('Missing the required parameter $user when calling listUserConsentSessions');
+ }
+ // parse inputs
+ $resourcePath = "/oauth2/auth/sessions/consent/{user}";
+ $httpBody = '';
+ $queryParams = [];
+ $headerParams = [];
+ $formParams = [];
+ $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']);
+ if (!is_null($_header_accept)) {
+ $headerParams['Accept'] = $_header_accept;
+ }
+ $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);
+
+ // path params
+ if ($user !== null) {
+ $resourcePath = str_replace(
+ "{" . "user" . "}",
+ $this->apiClient->getSerializer()->toPathValue($user),
+ $resourcePath
+ );
+ }
+
+ // for model (json/xml)
+ if (isset($_tempBody)) {
+ $httpBody = $_tempBody; // $_tempBody is the method argument, if present
+ } elseif (count($formParams) > 0) {
+ $httpBody = $formParams; // for HTTP post (form)
+ }
+ // make the API Call
+ try {
+ list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
+ $resourcePath,
+ 'GET',
+ $queryParams,
+ $httpBody,
+ $headerParams,
+ '\Hydra\SDK\Model\PreviousConsentSession[]',
+ '/oauth2/auth/sessions/consent/{user}'
+ );
+
+ return [$this->apiClient->getSerializer()->deserialize($response, '\Hydra\SDK\Model\PreviousConsentSession[]', $httpHeader), $statusCode, $httpHeader];
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Hydra\SDK\Model\PreviousConsentSession[]', $e->getResponseHeaders());
+ $e->setResponseObject($data);
+ break;
+ case 401:
+ $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Hydra\SDK\Model\InlineResponse401', $e->getResponseHeaders());
+ $e->setResponseObject($data);
+ break;
+ case 403:
+ $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Hydra\SDK\Model\InlineResponse401', $e->getResponseHeaders());
+ $e->setResponseObject($data);
+ break;
+ case 500:
+ $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Hydra\SDK\Model\InlineResponse401', $e->getResponseHeaders());
+ $e->setResponseObject($data);
+ break;
+ }
+
+ throw $e;
+ }
+ }
+
/**
* Operation oauthAuth
*
diff --git a/sdk/php/swagger/lib/Model/JSONWebKey.php b/sdk/php/swagger/lib/Model/JSONWebKey.php
new file mode 100644
index 00000000000..50080d87c7a
--- /dev/null
+++ b/sdk/php/swagger/lib/Model/JSONWebKey.php
@@ -0,0 +1,350 @@
+ 'string',
+ 'certificates' => '\Hydra\SDK\Model\Certificate[]',
+ 'key' => 'object',
+ 'key_id' => 'string',
+ 'use' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ * @var string[]
+ */
+ protected static $swaggerFormats = [
+ 'algorithm' => null,
+ 'certificates' => null,
+ 'key' => null,
+ 'key_id' => null,
+ 'use' => null
+ ];
+
+ public static function swaggerTypes()
+ {
+ return self::$swaggerTypes;
+ }
+
+ public static function swaggerFormats()
+ {
+ return self::$swaggerFormats;
+ }
+
+ /**
+ * Array of attributes where the key is the local name, and the value is the original name
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'algorithm' => 'Algorithm',
+ 'certificates' => 'Certificates',
+ 'key' => 'Key',
+ 'key_id' => 'KeyID',
+ 'use' => 'Use'
+ ];
+
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ * @var string[]
+ */
+ protected static $setters = [
+ 'algorithm' => 'setAlgorithm',
+ 'certificates' => 'setCertificates',
+ 'key' => 'setKey',
+ 'key_id' => 'setKeyId',
+ 'use' => 'setUse'
+ ];
+
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ * @var string[]
+ */
+ protected static $getters = [
+ 'algorithm' => 'getAlgorithm',
+ 'certificates' => 'getCertificates',
+ 'key' => 'getKey',
+ 'key_id' => 'getKeyId',
+ 'use' => 'getUse'
+ ];
+
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+
+
+
+
+ /**
+ * Associative array for storing property values
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ * @param mixed[] $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->container['algorithm'] = isset($data['algorithm']) ? $data['algorithm'] : null;
+ $this->container['certificates'] = isset($data['certificates']) ? $data['certificates'] : null;
+ $this->container['key'] = isset($data['key']) ? $data['key'] : null;
+ $this->container['key_id'] = isset($data['key_id']) ? $data['key_id'] : null;
+ $this->container['use'] = isset($data['use']) ? $data['use'] : null;
+ }
+
+ /**
+ * show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalid_properties = [];
+
+ return $invalid_properties;
+ }
+
+ /**
+ * validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+
+ return true;
+ }
+
+
+ /**
+ * Gets algorithm
+ * @return string
+ */
+ public function getAlgorithm()
+ {
+ return $this->container['algorithm'];
+ }
+
+ /**
+ * Sets algorithm
+ * @param string $algorithm
+ * @return $this
+ */
+ public function setAlgorithm($algorithm)
+ {
+ $this->container['algorithm'] = $algorithm;
+
+ return $this;
+ }
+
+ /**
+ * Gets certificates
+ * @return \Hydra\SDK\Model\Certificate[]
+ */
+ public function getCertificates()
+ {
+ return $this->container['certificates'];
+ }
+
+ /**
+ * Sets certificates
+ * @param \Hydra\SDK\Model\Certificate[] $certificates
+ * @return $this
+ */
+ public function setCertificates($certificates)
+ {
+ $this->container['certificates'] = $certificates;
+
+ return $this;
+ }
+
+ /**
+ * Gets key
+ * @return object
+ */
+ public function getKey()
+ {
+ return $this->container['key'];
+ }
+
+ /**
+ * Sets key
+ * @param object $key
+ * @return $this
+ */
+ public function setKey($key)
+ {
+ $this->container['key'] = $key;
+
+ return $this;
+ }
+
+ /**
+ * Gets key_id
+ * @return string
+ */
+ public function getKeyId()
+ {
+ return $this->container['key_id'];
+ }
+
+ /**
+ * Sets key_id
+ * @param string $key_id
+ * @return $this
+ */
+ public function setKeyId($key_id)
+ {
+ $this->container['key_id'] = $key_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets use
+ * @return string
+ */
+ public function getUse()
+ {
+ return $this->container['use'];
+ }
+
+ /**
+ * Sets use
+ * @param string $use
+ * @return $this
+ */
+ public function setUse($use)
+ {
+ $this->container['use'] = $use;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ * @param integer $offset Offset
+ * @return boolean
+ */
+ public function offsetExists($offset)
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ * @param integer $offset Offset
+ * @return mixed
+ */
+ public function offsetGet($offset)
+ {
+ return isset($this->container[$offset]) ? $this->container[$offset] : null;
+ }
+
+ /**
+ * Sets value based on offset.
+ * @param integer $offset Offset
+ * @param mixed $value Value to be set
+ * @return void
+ */
+ public function offsetSet($offset, $value)
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ * @param integer $offset Offset
+ * @return void
+ */
+ public function offsetUnset($offset)
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ * @return string
+ */
+ public function __toString()
+ {
+ if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
+ return json_encode(\Hydra\SDK\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
+ }
+
+ return json_encode(\Hydra\SDK\ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/sdk/php/swagger/lib/Model/JSONWebKeySet.php b/sdk/php/swagger/lib/Model/JSONWebKeySet.php
new file mode 100644
index 00000000000..677d563a572
--- /dev/null
+++ b/sdk/php/swagger/lib/Model/JSONWebKeySet.php
@@ -0,0 +1,242 @@
+ '\Hydra\SDK\Model\JSONWebKey[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ * @var string[]
+ */
+ protected static $swaggerFormats = [
+ 'keys' => null
+ ];
+
+ public static function swaggerTypes()
+ {
+ return self::$swaggerTypes;
+ }
+
+ public static function swaggerFormats()
+ {
+ return self::$swaggerFormats;
+ }
+
+ /**
+ * Array of attributes where the key is the local name, and the value is the original name
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'keys' => 'keys'
+ ];
+
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ * @var string[]
+ */
+ protected static $setters = [
+ 'keys' => 'setKeys'
+ ];
+
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ * @var string[]
+ */
+ protected static $getters = [
+ 'keys' => 'getKeys'
+ ];
+
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+
+
+
+
+ /**
+ * Associative array for storing property values
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ * @param mixed[] $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->container['keys'] = isset($data['keys']) ? $data['keys'] : null;
+ }
+
+ /**
+ * show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalid_properties = [];
+
+ return $invalid_properties;
+ }
+
+ /**
+ * validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+
+ return true;
+ }
+
+
+ /**
+ * Gets keys
+ * @return \Hydra\SDK\Model\JSONWebKey[]
+ */
+ public function getKeys()
+ {
+ return $this->container['keys'];
+ }
+
+ /**
+ * Sets keys
+ * @param \Hydra\SDK\Model\JSONWebKey[] $keys
+ * @return $this
+ */
+ public function setKeys($keys)
+ {
+ $this->container['keys'] = $keys;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ * @param integer $offset Offset
+ * @return boolean
+ */
+ public function offsetExists($offset)
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ * @param integer $offset Offset
+ * @return mixed
+ */
+ public function offsetGet($offset)
+ {
+ return isset($this->container[$offset]) ? $this->container[$offset] : null;
+ }
+
+ /**
+ * Sets value based on offset.
+ * @param integer $offset Offset
+ * @param mixed $value Value to be set
+ * @return void
+ */
+ public function offsetSet($offset, $value)
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ * @param integer $offset Offset
+ * @return void
+ */
+ public function offsetUnset($offset)
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ * @return string
+ */
+ public function __toString()
+ {
+ if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
+ return json_encode(\Hydra\SDK\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
+ }
+
+ return json_encode(\Hydra\SDK\ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/sdk/php/swagger/lib/Model/PreviousConsentSession.php b/sdk/php/swagger/lib/Model/PreviousConsentSession.php
new file mode 100644
index 00000000000..24ec8aab3b0
--- /dev/null
+++ b/sdk/php/swagger/lib/Model/PreviousConsentSession.php
@@ -0,0 +1,351 @@
+ '\Hydra\SDK\Model\ConsentRequest',
+ 'grant_scope' => 'string[]',
+ 'remember' => 'bool',
+ 'remember_for' => 'int',
+ 'session' => '\Hydra\SDK\Model\ConsentRequestSession'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ * @var string[]
+ */
+ protected static $swaggerFormats = [
+ 'consent_request' => null,
+ 'grant_scope' => null,
+ 'remember' => null,
+ 'remember_for' => 'int64',
+ 'session' => null
+ ];
+
+ public static function swaggerTypes()
+ {
+ return self::$swaggerTypes;
+ }
+
+ public static function swaggerFormats()
+ {
+ return self::$swaggerFormats;
+ }
+
+ /**
+ * Array of attributes where the key is the local name, and the value is the original name
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'consent_request' => 'consent_request',
+ 'grant_scope' => 'grant_scope',
+ 'remember' => 'remember',
+ 'remember_for' => 'remember_for',
+ 'session' => 'session'
+ ];
+
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ * @var string[]
+ */
+ protected static $setters = [
+ 'consent_request' => 'setConsentRequest',
+ 'grant_scope' => 'setGrantScope',
+ 'remember' => 'setRemember',
+ 'remember_for' => 'setRememberFor',
+ 'session' => 'setSession'
+ ];
+
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ * @var string[]
+ */
+ protected static $getters = [
+ 'consent_request' => 'getConsentRequest',
+ 'grant_scope' => 'getGrantScope',
+ 'remember' => 'getRemember',
+ 'remember_for' => 'getRememberFor',
+ 'session' => 'getSession'
+ ];
+
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+
+
+
+
+ /**
+ * Associative array for storing property values
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ * @param mixed[] $data Associated array of property values initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->container['consent_request'] = isset($data['consent_request']) ? $data['consent_request'] : null;
+ $this->container['grant_scope'] = isset($data['grant_scope']) ? $data['grant_scope'] : null;
+ $this->container['remember'] = isset($data['remember']) ? $data['remember'] : null;
+ $this->container['remember_for'] = isset($data['remember_for']) ? $data['remember_for'] : null;
+ $this->container['session'] = isset($data['session']) ? $data['session'] : null;
+ }
+
+ /**
+ * show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalid_properties = [];
+
+ return $invalid_properties;
+ }
+
+ /**
+ * validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+
+ return true;
+ }
+
+
+ /**
+ * Gets consent_request
+ * @return \Hydra\SDK\Model\ConsentRequest
+ */
+ public function getConsentRequest()
+ {
+ return $this->container['consent_request'];
+ }
+
+ /**
+ * Sets consent_request
+ * @param \Hydra\SDK\Model\ConsentRequest $consent_request
+ * @return $this
+ */
+ public function setConsentRequest($consent_request)
+ {
+ $this->container['consent_request'] = $consent_request;
+
+ return $this;
+ }
+
+ /**
+ * Gets grant_scope
+ * @return string[]
+ */
+ public function getGrantScope()
+ {
+ return $this->container['grant_scope'];
+ }
+
+ /**
+ * Sets grant_scope
+ * @param string[] $grant_scope GrantScope sets the scope the user authorized the client to use. Should be a subset of `requested_scope`
+ * @return $this
+ */
+ public function setGrantScope($grant_scope)
+ {
+ $this->container['grant_scope'] = $grant_scope;
+
+ return $this;
+ }
+
+ /**
+ * Gets remember
+ * @return bool
+ */
+ public function getRemember()
+ {
+ return $this->container['remember'];
+ }
+
+ /**
+ * Sets remember
+ * @param bool $remember Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope.
+ * @return $this
+ */
+ public function setRemember($remember)
+ {
+ $this->container['remember'] = $remember;
+
+ return $this;
+ }
+
+ /**
+ * Gets remember_for
+ * @return int
+ */
+ public function getRememberFor()
+ {
+ return $this->container['remember_for'];
+ }
+
+ /**
+ * Sets remember_for
+ * @param int $remember_for RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely.
+ * @return $this
+ */
+ public function setRememberFor($remember_for)
+ {
+ $this->container['remember_for'] = $remember_for;
+
+ return $this;
+ }
+
+ /**
+ * Gets session
+ * @return \Hydra\SDK\Model\ConsentRequestSession
+ */
+ public function getSession()
+ {
+ return $this->container['session'];
+ }
+
+ /**
+ * Sets session
+ * @param \Hydra\SDK\Model\ConsentRequestSession $session
+ * @return $this
+ */
+ public function setSession($session)
+ {
+ $this->container['session'] = $session;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ * @param integer $offset Offset
+ * @return boolean
+ */
+ public function offsetExists($offset)
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ * @param integer $offset Offset
+ * @return mixed
+ */
+ public function offsetGet($offset)
+ {
+ return isset($this->container[$offset]) ? $this->container[$offset] : null;
+ }
+
+ /**
+ * Sets value based on offset.
+ * @param integer $offset Offset
+ * @param mixed $value Value to be set
+ * @return void
+ */
+ public function offsetSet($offset, $value)
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ * @param integer $offset Offset
+ * @return void
+ */
+ public function offsetUnset($offset)
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ * @return string
+ */
+ public function __toString()
+ {
+ if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
+ return json_encode(\Hydra\SDK\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
+ }
+
+ return json_encode(\Hydra\SDK\ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+