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
d33a76fa
Commit
d33a76fa
authored
5 years ago
by
Chris Loukas
Browse files
Options
Downloads
Patches
Plain Diff
Make prompt configurable for oidc offline_access
parent
f17fa677
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/connectors/oidc.md
+5
-0
5 additions, 0 deletions
Documentation/connectors/oidc.md
connector/oidc/oidc.go
+11
-1
11 additions, 1 deletion
connector/oidc/oidc.go
with
16 additions
and
1 deletion
Documentation/connectors/oidc.md
+
5
−
0
View file @
d33a76fa
...
@@ -83,6 +83,11 @@ connectors:
...
@@ -83,6 +83,11 @@ connectors:
# The set claim is used as user name.
# The set claim is used as user name.
# Default: name
# Default: name
# userNameKey: nickname
# userNameKey: nickname
# For offline_access, the prompt parameter is set by default to "prompt=consent".
# However this is not supported by all OIDC providers, some of them support different
# value for prompt, like "prompt=login" or "prompt=none"
# promptType: consent
```
```
[
oidc-doc
]:
openid-connect.md
[
oidc-doc
]:
openid-connect.md
...
...
This diff is collapsed.
Click to expand it.
connector/oidc/oidc.go
+
11
−
1
View file @
d33a76fa
...
@@ -54,6 +54,9 @@ type Config struct {
...
@@ -54,6 +54,9 @@ type Config struct {
// Configurable key which contains the user name claim
// Configurable key which contains the user name claim
UserNameKey
string
`json:"userNameKey"`
UserNameKey
string
`json:"userNameKey"`
// PromptType will be used fot the prompt parameter (when offline_access, by default prompt=consent)
PromptType
string
`json:"promptType"`
}
}
// Domains that don't support basic auth. golang.org/x/oauth2 has an internal
// Domains that don't support basic auth. golang.org/x/oauth2 has an internal
...
@@ -113,6 +116,11 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
...
@@ -113,6 +116,11 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
scopes
=
append
(
scopes
,
"profile"
,
"email"
)
scopes
=
append
(
scopes
,
"profile"
,
"email"
)
}
}
// PromptType should be "consent" by default, if not set
if
c
.
PromptType
==
""
{
c
.
PromptType
=
"consent"
}
clientID
:=
c
.
ClientID
clientID
:=
c
.
ClientID
return
&
oidcConnector
{
return
&
oidcConnector
{
provider
:
provider
,
provider
:
provider
,
...
@@ -135,6 +143,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
...
@@ -135,6 +143,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
getUserInfo
:
c
.
GetUserInfo
,
getUserInfo
:
c
.
GetUserInfo
,
userIDKey
:
c
.
UserIDKey
,
userIDKey
:
c
.
UserIDKey
,
userNameKey
:
c
.
UserNameKey
,
userNameKey
:
c
.
UserNameKey
,
promptType
:
c
.
PromptType
,
},
nil
},
nil
}
}
...
@@ -156,6 +165,7 @@ type oidcConnector struct {
...
@@ -156,6 +165,7 @@ type oidcConnector struct {
getUserInfo
bool
getUserInfo
bool
userIDKey
string
userIDKey
string
userNameKey
string
userNameKey
string
promptType
string
}
}
func
(
c
*
oidcConnector
)
Close
()
error
{
func
(
c
*
oidcConnector
)
Close
()
error
{
...
@@ -178,7 +188,7 @@ func (c *oidcConnector) LoginURL(s connector.Scopes, callbackURL, state string)
...
@@ -178,7 +188,7 @@ func (c *oidcConnector) LoginURL(s connector.Scopes, callbackURL, state string)
}
}
if
s
.
OfflineAccess
{
if
s
.
OfflineAccess
{
opts
=
append
(
opts
,
oauth2
.
AccessTypeOffline
,
oauth2
.
SetAuthURLParam
(
"prompt"
,
"consent"
))
opts
=
append
(
opts
,
oauth2
.
AccessTypeOffline
,
oauth2
.
SetAuthURLParam
(
"prompt"
,
c
.
promptType
))
}
}
return
c
.
oauth2Config
.
AuthCodeURL
(
state
,
opts
...
),
nil
return
c
.
oauth2Config
.
AuthCodeURL
(
state
,
opts
...
),
nil
}
}
...
...
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