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
e1a40783
Unverified
Commit
e1a40783
authored
2 years ago
by
Bob Callaway
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add config to explicitly set scopes for microsoft connector (#2582)
Signed-off-by:
Bob Callaway
<
bcallaway@google.com
>
parent
83e2df82
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
connector/microsoft/microsoft.go
+10
-1
10 additions, 1 deletion
connector/microsoft/microsoft.go
with
10 additions
and
1 deletion
connector/microsoft/microsoft.go
+
10
−
1
View file @
e1a40783
...
@@ -58,6 +58,8 @@ type Config struct {
...
@@ -58,6 +58,8 @@ type Config struct {
// For valid values, see https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-authorization-code.
// For valid values, see https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-authorization-code.
PromptType
string
`json:"promptType"`
PromptType
string
`json:"promptType"`
DomainHint
string
`json:"domainHint"`
DomainHint
string
`json:"domainHint"`
Scopes
[]
string
`json:"scopes"`
// defaults to scopeUser (user.read)
}
}
// Open returns a strategy for logging in through Microsoft.
// Open returns a strategy for logging in through Microsoft.
...
@@ -77,6 +79,7 @@ func (c *Config) Open(id string, logger log.Logger) (connector.Connector, error)
...
@@ -77,6 +79,7 @@ func (c *Config) Open(id string, logger log.Logger) (connector.Connector, error)
emailToLowercase
:
c
.
EmailToLowercase
,
emailToLowercase
:
c
.
EmailToLowercase
,
promptType
:
c
.
PromptType
,
promptType
:
c
.
PromptType
,
domainHint
:
c
.
DomainHint
,
domainHint
:
c
.
DomainHint
,
scopes
:
c
.
Scopes
,
}
}
// By default allow logins from both personal and business/school
// By default allow logins from both personal and business/school
// accounts.
// accounts.
...
@@ -122,6 +125,7 @@ type microsoftConnector struct {
...
@@ -122,6 +125,7 @@ type microsoftConnector struct {
emailToLowercase
bool
emailToLowercase
bool
promptType
string
promptType
string
domainHint
string
domainHint
string
scopes
[]
string
}
}
func
(
c
*
microsoftConnector
)
isOrgTenant
()
bool
{
func
(
c
*
microsoftConnector
)
isOrgTenant
()
bool
{
...
@@ -133,7 +137,12 @@ func (c *microsoftConnector) groupsRequired(groupScope bool) bool {
...
@@ -133,7 +137,12 @@ func (c *microsoftConnector) groupsRequired(groupScope bool) bool {
}
}
func
(
c
*
microsoftConnector
)
oauth2Config
(
scopes
connector
.
Scopes
)
*
oauth2
.
Config
{
func
(
c
*
microsoftConnector
)
oauth2Config
(
scopes
connector
.
Scopes
)
*
oauth2
.
Config
{
microsoftScopes
:=
[]
string
{
scopeUser
}
var
microsoftScopes
[]
string
if
len
(
c
.
scopes
)
>
0
{
microsoftScopes
=
c
.
scopes
}
else
{
microsoftScopes
=
append
(
microsoftScopes
,
scopeUser
)
}
if
c
.
groupsRequired
(
scopes
.
Groups
)
{
if
c
.
groupsRequired
(
scopes
.
Groups
)
{
microsoftScopes
=
append
(
microsoftScopes
,
scopeGroups
)
microsoftScopes
=
append
(
microsoftScopes
,
scopeGroups
)
}
}
...
...
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