Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
dex
Commits
176ba709
Unverified
Commit
176ba709
authored
6 years ago
by
Joel Speed
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Remove connectordata from other structs"
This reverts commit 27f33516db343bd79b56a47ecef0fe514a35082d.
parent
fea048b3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
server/api_test.go
+1
-0
1 addition, 0 deletions
server/api_test.go
server/handlers.go
+20
-17
20 additions, 17 deletions
server/handlers.go
storage/storage.go
+8
-5
8 additions, 5 deletions
storage/storage.go
with
29 additions
and
22 deletions
server/api_test.go
+
1
−
0
View file @
176ba709
...
...
@@ -259,6 +259,7 @@ func TestRefreshToken(t *testing.T) {
EmailVerified
:
true
,
Groups
:
[]
string
{
"a"
,
"b"
},
},
ConnectorData
:
[]
byte
(
`{"some":"data"}`
),
}
if
err
:=
s
.
CreateRefresh
(
r
);
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
server/handlers.go
+
20
−
17
View file @
176ba709
...
...
@@ -490,6 +490,7 @@ func (s *Server) finalizeLogin(identity connector.Identity, authReq storage.Auth
updater
:=
func
(
a
storage
.
AuthRequest
)
(
storage
.
AuthRequest
,
error
)
{
a
.
LoggedIn
=
true
a
.
Claims
=
claims
a
.
ConnectorData
=
identity
.
ConnectorData
return
a
,
nil
}
if
err
:=
s
.
storage
.
UpdateAuthRequest
(
authReq
.
ID
,
updater
);
err
!=
nil
{
...
...
@@ -621,14 +622,15 @@ func (s *Server) sendCodeResponse(w http.ResponseWriter, r *http.Request, authRe
switch
responseType
{
case
responseTypeCode
:
code
=
storage
.
AuthCode
{
ID
:
storage
.
NewID
(),
ClientID
:
authReq
.
ClientID
,
ConnectorID
:
authReq
.
ConnectorID
,
Nonce
:
authReq
.
Nonce
,
Scopes
:
authReq
.
Scopes
,
Claims
:
authReq
.
Claims
,
Expiry
:
s
.
now
()
.
Add
(
time
.
Minute
*
30
),
RedirectURI
:
authReq
.
RedirectURI
,
ID
:
storage
.
NewID
(),
ClientID
:
authReq
.
ClientID
,
ConnectorID
:
authReq
.
ConnectorID
,
Nonce
:
authReq
.
Nonce
,
Scopes
:
authReq
.
Scopes
,
Claims
:
authReq
.
Claims
,
Expiry
:
s
.
now
()
.
Add
(
time
.
Minute
*
30
),
RedirectURI
:
authReq
.
RedirectURI
,
ConnectorData
:
authReq
.
ConnectorData
,
}
if
err
:=
s
.
storage
.
CreateAuthCode
(
code
);
err
!=
nil
{
s
.
logger
.
Errorf
(
"Failed to create auth code: %v"
,
err
)
...
...
@@ -824,15 +826,16 @@ func (s *Server) handleAuthCode(w http.ResponseWriter, r *http.Request, client s
var
refreshToken
string
if
reqRefresh
{
refresh
:=
storage
.
RefreshToken
{
ID
:
storage
.
NewID
(),
Token
:
storage
.
NewID
(),
ClientID
:
authCode
.
ClientID
,
ConnectorID
:
authCode
.
ConnectorID
,
Scopes
:
authCode
.
Scopes
,
Claims
:
authCode
.
Claims
,
Nonce
:
authCode
.
Nonce
,
CreatedAt
:
s
.
now
(),
LastUsed
:
s
.
now
(),
ID
:
storage
.
NewID
(),
Token
:
storage
.
NewID
(),
ClientID
:
authCode
.
ClientID
,
ConnectorID
:
authCode
.
ConnectorID
,
Scopes
:
authCode
.
Scopes
,
Claims
:
authCode
.
Claims
,
Nonce
:
authCode
.
Nonce
,
ConnectorData
:
authCode
.
ConnectorData
,
CreatedAt
:
s
.
now
(),
LastUsed
:
s
.
now
(),
}
token
:=
&
internal
.
RefreshToken
{
RefreshId
:
refresh
.
ID
,
...
...
This diff is collapsed.
Click to expand it.
storage/storage.go
+
8
−
5
View file @
176ba709
...
...
@@ -181,7 +181,8 @@ type AuthRequest struct {
// The connector used to login the user and any data the connector wishes to persists.
// Set when the user authenticates.
ConnectorID
string
ConnectorID
string
ConnectorData
[]
byte
}
// AuthCode represents a code which can be exchanged for an OAuth2 token response.
...
...
@@ -212,8 +213,9 @@ type AuthCode struct {
Scopes
[]
string
// Authentication data provided by an upstream source.
ConnectorID
string
Claims
Claims
ConnectorID
string
ConnectorData
[]
byte
Claims
Claims
Expiry
time
.
Time
}
...
...
@@ -235,8 +237,9 @@ type RefreshToken struct {
ClientID
string
// Authentication data provided by an upstream source.
ConnectorID
string
Claims
Claims
ConnectorID
string
ConnectorData
[]
byte
Claims
Claims
// Scopes present in the initial request. Refresh requests may specify a set
// of scopes different from the initial request when refreshing a token,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment