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
658a2cc4
Unverified
Commit
658a2cc4
authored
6 years ago
by
Joel Speed
Browse files
Options
Downloads
Patches
Plain Diff
Make directory service during init
parent
554870ce
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/google/google.go
+9
-6
9 additions, 6 deletions
connector/google/google.go
with
9 additions
and
6 deletions
connector/google/google.go
+
9
−
6
View file @
658a2cc4
...
@@ -62,6 +62,12 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
...
@@ -62,6 +62,12 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
scopes
=
append
(
scopes
,
"profile"
,
"email"
)
scopes
=
append
(
scopes
,
"profile"
,
"email"
)
}
}
srv
,
err
:=
createDirectoryService
(
c
.
ServiceAccountFilePath
,
c
.
AdminEmail
)
if
err
!=
nil
{
cancel
()
return
nil
,
fmt
.
Errorf
(
"could not create directory service: %v"
,
err
)
}
clientID
:=
c
.
ClientID
clientID
:=
c
.
ClientID
return
&
googleConnector
{
return
&
googleConnector
{
redirectURI
:
c
.
RedirectURI
,
redirectURI
:
c
.
RedirectURI
,
...
@@ -80,6 +86,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
...
@@ -80,6 +86,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
hostedDomains
:
c
.
HostedDomains
,
hostedDomains
:
c
.
HostedDomains
,
serviceAccountFilePath
:
c
.
ServiceAccountFilePath
,
serviceAccountFilePath
:
c
.
ServiceAccountFilePath
,
adminEmail
:
c
.
AdminEmail
,
adminEmail
:
c
.
AdminEmail
,
adminSrv
:
srv
,
},
nil
},
nil
}
}
...
@@ -98,6 +105,7 @@ type googleConnector struct {
...
@@ -98,6 +105,7 @@ type googleConnector struct {
hostedDomains
[]
string
hostedDomains
[]
string
serviceAccountFilePath
string
serviceAccountFilePath
string
adminEmail
string
adminEmail
string
adminSrv
*
admin
.
Service
}
}
func
(
c
*
googleConnector
)
Close
()
error
{
func
(
c
*
googleConnector
)
Close
()
error
{
...
@@ -219,12 +227,7 @@ func (c *googleConnector) createIdentity(ctx context.Context, identity connector
...
@@ -219,12 +227,7 @@ func (c *googleConnector) createIdentity(ctx context.Context, identity connector
// getGroups creates a connection to the admin directory service and lists
// getGroups creates a connection to the admin directory service and lists
// all groups the user is a member of
// all groups the user is a member of
func
(
c
*
googleConnector
)
getGroups
(
email
string
)
([]
string
,
error
)
{
func
(
c
*
googleConnector
)
getGroups
(
email
string
)
([]
string
,
error
)
{
srv
,
err
:=
createDirectoryService
(
c
.
serviceAccountFilePath
,
c
.
adminEmail
)
groupsList
,
err
:=
c
.
adminSrv
.
Groups
.
List
()
.
UserKey
(
email
)
.
Do
()
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"could not create directory service: %v"
,
err
)
}
groupsList
,
err
:=
srv
.
Groups
.
List
()
.
UserKey
(
email
)
.
Do
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"could not list groups: %v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"could not list groups: %v"
,
err
)
}
}
...
...
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