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
02c8f85e
Unverified
Commit
02c8f85e
authored
5 years ago
by
Andrew Block
Browse files
Options
Downloads
Patches
Plain Diff
Resolved newline issues
parent
db7711d7
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
connector/openshift/openshift.go
+1
-3
1 addition, 3 deletions
connector/openshift/openshift.go
connector/openshift/openshift_test.go
+0
-4
0 additions, 4 deletions
connector/openshift/openshift_test.go
with
1 addition
and
7 deletions
connector/openshift/openshift.go
+
1
−
3
View file @
02c8f85e
...
@@ -59,7 +59,6 @@ type user struct {
...
@@ -59,7 +59,6 @@ type user struct {
// Open returns a connector which can be used to login users through an upstream
// Open returns a connector which can be used to login users through an upstream
// OpenShift OAuth2 provider.
// OpenShift OAuth2 provider.
func
(
c
*
Config
)
Open
(
id
string
,
logger
log
.
Logger
)
(
conn
connector
.
Connector
,
err
error
)
{
func
(
c
*
Config
)
Open
(
id
string
,
logger
log
.
Logger
)
(
conn
connector
.
Connector
,
err
error
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
wellKnownURL
:=
strings
.
TrimSuffix
(
c
.
Issuer
,
"/"
)
+
"/.well-known/oauth-authorization-server"
wellKnownURL
:=
strings
.
TrimSuffix
(
c
.
Issuer
,
"/"
)
+
"/.well-known/oauth-authorization-server"
...
@@ -91,7 +90,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
...
@@ -91,7 +90,7 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
if
err
!=
nil
{
if
err
!=
nil
{
cancel
()
cancel
()
return
nil
,
fmt
.
Errorf
(
"
F
ailed to query OpenShift
E
ndpoint %v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"
f
ailed to query OpenShift
e
ndpoint %v"
,
err
)
}
}
defer
resp
.
Body
.
Close
()
defer
resp
.
Body
.
Close
()
...
@@ -211,7 +210,6 @@ func (c *openshiftConnector) user(ctx context.Context, client *http.Client) (u u
...
@@ -211,7 +210,6 @@ func (c *openshiftConnector) user(ctx context.Context, client *http.Client) (u u
}
}
func
validateRequiredGroups
(
userGroups
,
requiredGroups
[]
string
)
bool
{
func
validateRequiredGroups
(
userGroups
,
requiredGroups
[]
string
)
bool
{
matchingGroups
:=
groups
.
Filter
(
userGroups
,
requiredGroups
)
matchingGroups
:=
groups
.
Filter
(
userGroups
,
requiredGroups
)
return
len
(
requiredGroups
)
==
len
(
matchingGroups
)
return
len
(
requiredGroups
)
==
len
(
matchingGroups
)
...
...
This diff is collapsed.
Click to expand it.
connector/openshift/openshift_test.go
+
0
−
4
View file @
02c8f85e
...
@@ -80,7 +80,6 @@ func TestGetUser(t *testing.T) {
...
@@ -80,7 +80,6 @@ func TestGetUser(t *testing.T) {
expectEquals
(
t
,
u
.
Name
,
"jdoe"
)
expectEquals
(
t
,
u
.
Name
,
"jdoe"
)
expectEquals
(
t
,
u
.
FullName
,
"John Doe"
)
expectEquals
(
t
,
u
.
FullName
,
"John Doe"
)
expectEquals
(
t
,
len
(
u
.
Groups
),
1
)
expectEquals
(
t
,
len
(
u
.
Groups
),
1
)
}
}
func
TestVerifyGroupFn
(
t
*
testing
.
T
)
{
func
TestVerifyGroupFn
(
t
*
testing
.
T
)
{
...
@@ -90,7 +89,6 @@ func TestVerifyGroupFn(t *testing.T) {
...
@@ -90,7 +89,6 @@ func TestVerifyGroupFn(t *testing.T) {
validGroupMembership
:=
validateRequiredGroups
(
groupMembership
,
requiredGroups
)
validGroupMembership
:=
validateRequiredGroups
(
groupMembership
,
requiredGroups
)
expectEquals
(
t
,
validGroupMembership
,
true
)
expectEquals
(
t
,
validGroupMembership
,
true
)
}
}
func
TestVerifyGroup
(
t
*
testing
.
T
)
{
func
TestVerifyGroup
(
t
*
testing
.
T
)
{
...
@@ -122,7 +120,6 @@ func TestVerifyGroup(t *testing.T) {
...
@@ -122,7 +120,6 @@ func TestVerifyGroup(t *testing.T) {
expectEquals
(
t
,
u
.
Name
,
"jdoe"
)
expectEquals
(
t
,
u
.
Name
,
"jdoe"
)
expectEquals
(
t
,
u
.
FullName
,
"John Doe"
)
expectEquals
(
t
,
u
.
FullName
,
"John Doe"
)
expectEquals
(
t
,
len
(
u
.
Groups
),
1
)
expectEquals
(
t
,
len
(
u
.
Groups
),
1
)
}
}
func
TestCallbackIdentity
(
t
*
testing
.
T
)
{
func
TestCallbackIdentity
(
t
*
testing
.
T
)
{
...
@@ -169,7 +166,6 @@ func TestCallbackIdentity(t *testing.T) {
...
@@ -169,7 +166,6 @@ func TestCallbackIdentity(t *testing.T) {
}
}
func
newTestServer
(
responses
map
[
string
]
interface
{})
*
httptest
.
Server
{
func
newTestServer
(
responses
map
[
string
]
interface
{})
*
httptest
.
Server
{
var
s
*
httptest
.
Server
var
s
*
httptest
.
Server
s
=
httptest
.
NewTLSServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
s
=
httptest
.
NewTLSServer
(
http
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
...
...
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