Skip to content

Commit

Permalink
chore: synchronize workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 27, 2023
1 parent fce930e commit 419c4fc
Show file tree
Hide file tree
Showing 10 changed files with 527 additions and 6 deletions.
5 changes: 4 additions & 1 deletion consent/csrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
package consent

import (
"github.com/ory/hydra/v2/flow"
"net/http"
"strings"
"time"

"github.com/ory/hydra/v2/flow"

"github.com/gorilla/sessions"

"github.com/ory/fosite"
Expand All @@ -19,6 +20,8 @@ import (
"github.com/ory/x/mapx"
)

// WARNING - changes in this file need to be mirrored elsewhere.

func createCsrfSession(w http.ResponseWriter, r *http.Request, conf x.CookieConfigProvider, store sessions.Store, name string, csrfValue string, maxAge time.Duration) error {
// Errors can be ignored here, because we always get a session back. Error typically means that the
// session doesn't exist yet.
Expand Down
10 changes: 8 additions & 2 deletions flow/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ func (f *Flow) HandleLoginRequest(h *HandledLoginRequest) error {
} else {
f.State = FlowStateLoginUnused
}

if f.Context != nil {
f.Context = h.Context
}

f.ID = h.ID
f.Subject = h.Subject
f.ForceSubjectIdentifier = h.ForceSubjectIdentifier
Expand All @@ -301,7 +306,6 @@ func (f *Flow) HandleLoginRequest(h *HandledLoginRequest) error {
f.LoginExtendSessionLifespan = h.ExtendSessionLifespan
f.ACR = h.ACR
f.AMR = h.AMR
f.Context = h.Context
f.LoginWasUsed = h.WasHandled
f.LoginAuthenticatedAt = h.AuthenticatedAt
return nil
Expand Down Expand Up @@ -394,7 +398,9 @@ func (f *Flow) HandleConsentRequest(r *AcceptOAuth2ConsentRequest) error {
f.ConsentHandledAt = r.HandledAt
f.ConsentWasHandled = r.WasHandled
f.ConsentError = r.Error
f.Context = r.Context
if r.Context != nil {
f.Context = r.Context
}

if r.Session != nil {
f.SessionIDToken = r.Session.IDToken
Expand Down
7 changes: 7 additions & 0 deletions internal/httpclient/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,9 @@ components:
type: object
acceptOAuth2ConsentRequest:
properties:
context:
title: "JSONRawMessage represents a json.RawMessage that works well with\
\ JSON, SQL, and Swagger."
grant_access_token_audience:
items:
type: string
Expand Down Expand Up @@ -3272,6 +3275,7 @@ components:
session:
access_token: ""
id_token: ""
context: ""
grant_access_token_audience:
- grant_access_token_audience
- grant_access_token_audience
Expand All @@ -3283,6 +3287,9 @@ components:
properties:
consent_request:
$ref: '#/components/schemas/oAuth2ConsentRequest'
context:
title: "JSONRawMessage represents a json.RawMessage that works well with\
\ JSON, SQL, and Swagger."
expires_at:
$ref: '#/components/schemas/oAuth2ConsentSession_expires_at'
grant_access_token_audience:
Expand Down
36 changes: 36 additions & 0 deletions internal/httpclient/docs/AcceptOAuth2ConsentRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Context** | Pointer to **interface{}** | | [optional]
**GrantAccessTokenAudience** | Pointer to **[]string** | | [optional]
**GrantScope** | Pointer to **[]string** | | [optional]
**HandledAt** | Pointer to **time.Time** | | [optional]
Expand All @@ -30,6 +31,41 @@ NewAcceptOAuth2ConsentRequestWithDefaults instantiates a new AcceptOAuth2Consent
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set

### GetContext

`func (o *AcceptOAuth2ConsentRequest) GetContext() interface{}`

GetContext returns the Context field if non-nil, zero value otherwise.

### GetContextOk

`func (o *AcceptOAuth2ConsentRequest) GetContextOk() (*interface{}, bool)`

GetContextOk returns a tuple with the Context field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetContext

`func (o *AcceptOAuth2ConsentRequest) SetContext(v interface{})`

SetContext sets Context field to given value.

### HasContext

`func (o *AcceptOAuth2ConsentRequest) HasContext() bool`

HasContext returns a boolean if a field has been set.

### SetContextNil

`func (o *AcceptOAuth2ConsentRequest) SetContextNil(b bool)`

SetContextNil sets the value for Context to be an explicit nil

### UnsetContext
`func (o *AcceptOAuth2ConsentRequest) UnsetContext()`

UnsetContext ensures that no value is present for Context, not even an explicit nil
### GetGrantAccessTokenAudience

`func (o *AcceptOAuth2ConsentRequest) GetGrantAccessTokenAudience() []string`
Expand Down
36 changes: 36 additions & 0 deletions internal/httpclient/docs/OAuth2ConsentSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ConsentRequest** | Pointer to [**OAuth2ConsentRequest**](OAuth2ConsentRequest.md) | | [optional]
**Context** | Pointer to **interface{}** | | [optional]
**ExpiresAt** | Pointer to [**OAuth2ConsentSessionExpiresAt**](OAuth2ConsentSessionExpiresAt.md) | | [optional]
**GrantAccessTokenAudience** | Pointer to **[]string** | | [optional]
**GrantScope** | Pointer to **[]string** | | [optional]
Expand Down Expand Up @@ -57,6 +58,41 @@ SetConsentRequest sets ConsentRequest field to given value.

HasConsentRequest returns a boolean if a field has been set.

### GetContext

`func (o *OAuth2ConsentSession) GetContext() interface{}`

GetContext returns the Context field if non-nil, zero value otherwise.

### GetContextOk

`func (o *OAuth2ConsentSession) GetContextOk() (*interface{}, bool)`

GetContextOk returns a tuple with the Context field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetContext

`func (o *OAuth2ConsentSession) SetContext(v interface{})`

SetContext sets Context field to given value.

### HasContext

`func (o *OAuth2ConsentSession) HasContext() bool`

HasContext returns a boolean if a field has been set.

### SetContextNil

`func (o *OAuth2ConsentSession) SetContextNil(b bool)`

SetContextNil sets the value for Context to be an explicit nil

### UnsetContext
`func (o *OAuth2ConsentSession) UnsetContext()`

UnsetContext ensures that no value is present for Context, not even an explicit nil
### GetExpiresAt

`func (o *OAuth2ConsentSession) GetExpiresAt() OAuth2ConsentSessionExpiresAt`
Expand Down
Loading

0 comments on commit 419c4fc

Please sign in to comment.