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
217b5ca2
Commit
217b5ca2
authored
8 years ago
by
Phu Kieu
Browse files
Options
Downloads
Patches
Plain Diff
Add ssoIssuer to fix Response issuer checking
Rename issuer to entityIssuer
parent
207d2077
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/saml/saml.go
+12
-9
12 additions, 9 deletions
connector/saml/saml.go
connector/saml/saml_test.go
+7
-7
7 additions, 7 deletions
connector/saml/saml_test.go
with
19 additions
and
16 deletions
connector/saml/saml.go
+
12
−
9
View file @
217b5ca2
...
...
@@ -81,8 +81,9 @@ type Config struct {
//
// https://www.oasis-open.org/committees/download.php/35391/sstc-saml-metadata-errata-2.0-wd-04-diff.pdf
Issuer
string
`json:"issuer"`
SSOURL
string
`json:"ssoURL"`
EntityIssuer
string
`json:"entityIssuer"`
SSOIssuer
string
`json:"ssoIssuer"`
SSOURL
string
`json:"ssoURL"`
// X509 CA file or raw data to verify XML signatures.
CA
string
`json:"ca"`
...
...
@@ -154,7 +155,8 @@ func (c *Config) openConnector(logger logrus.FieldLogger) (*provider, error) {
}
p
:=
&
provider
{
issuer
:
c
.
Issuer
,
entityIssuer
:
c
.
EntityIssuer
,
ssoIssuer
:
c
.
SSOIssuer
,
ssoURL
:
c
.
SSOURL
,
now
:
time
.
Now
,
usernameAttr
:
c
.
UsernameAttr
,
...
...
@@ -217,8 +219,9 @@ func (c *Config) openConnector(logger logrus.FieldLogger) (*provider, error) {
}
type
provider
struct
{
issuer
string
ssoURL
string
entityIssuer
string
ssoIssuer
string
ssoURL
string
now
func
()
time
.
Time
...
...
@@ -251,10 +254,10 @@ func (p *provider) POSTData(s connector.Scopes, id string) (action, value string
},
AssertionConsumerServiceURL
:
p
.
redirectURI
,
}
if
p
.
i
ssuer
!=
""
{
if
p
.
entityI
ssuer
!=
""
{
// Issuer for the request is optional. For example, okta always ignores
// this value.
r
.
Issuer
=
&
issuer
{
Issuer
:
p
.
i
ssuer
}
r
.
Issuer
=
&
issuer
{
Issuer
:
p
.
entityI
ssuer
}
}
data
,
err
:=
xml
.
MarshalIndent
(
r
,
""
,
" "
)
...
...
@@ -287,8 +290,8 @@ func (p *provider) HandlePOST(s connector.Scopes, samlResponse, inResponseTo str
}
if
rootElementSigned
{
if
p
.
i
ssuer
!=
""
&&
resp
.
Issuer
!=
nil
&&
resp
.
Issuer
.
Issuer
!=
p
.
i
ssuer
{
return
ident
,
fmt
.
Errorf
(
"expected Issuer value %s, got %s"
,
p
.
i
ssuer
,
resp
.
Issuer
.
Issuer
)
if
p
.
ssoI
ssuer
!=
""
&&
resp
.
Issuer
!=
nil
&&
resp
.
Issuer
.
Issuer
!=
p
.
ssoI
ssuer
{
return
ident
,
fmt
.
Errorf
(
"expected Issuer value %s, got %s"
,
p
.
entityI
ssuer
,
resp
.
Issuer
.
Issuer
)
}
// Verify InResponseTo value matches the expected ID associated with
...
...
This diff is collapsed.
Click to expand it.
connector/saml/saml_test.go
+
7
−
7
View file @
217b5ca2
...
...
@@ -278,14 +278,14 @@ func (r responseTest) run(t *testing.T) {
}
const
(
defaultIssuer
=
"http://www.okta.com/exk91cb99lKkKSYoy0h7"
default
SSO
Issuer
=
"http://www.okta.com/exk91cb99lKkKSYoy0h7"
defaultRedirectURI
=
"http://localhost:5556/dex/callback"
// Response ID embedded in our testdata.
testDataResponseID
=
"_fd1b3ef9-ec09-44a7-a66b-0d39c250f6a0"
)
// Depr
i
cated: Use testing framework established above.
// Depr
e
cated: Use testing framework established above.
func
runVerify
(
t
*
testing
.
T
,
ca
string
,
resp
string
,
shouldSucceed
bool
)
{
cert
,
err
:=
loadCert
(
ca
)
if
err
!=
nil
{
...
...
@@ -311,10 +311,10 @@ func runVerify(t *testing.T, ca string, resp string, shouldSucceed bool) {
}
}
// Depr
i
cated: Use testing framework established above.
func
newProvider
(
i
ssuer
string
,
redirectURI
string
)
*
provider
{
if
i
ssuer
==
""
{
i
ssuer
=
defaultIssuer
// Depr
e
cated: Use testing framework established above.
func
newProvider
(
ssoI
ssuer
string
,
redirectURI
string
)
*
provider
{
if
ssoI
ssuer
==
""
{
ssoI
ssuer
=
default
SSO
Issuer
}
if
redirectURI
==
""
{
redirectURI
=
defaultRedirectURI
...
...
@@ -322,7 +322,7 @@ func newProvider(issuer string, redirectURI string) *provider {
now
,
_
:=
time
.
Parse
(
time
.
RFC3339
,
"2017-01-24T20:48:41Z"
)
timeFunc
:=
func
()
time
.
Time
{
return
now
}
return
&
provider
{
i
ssuer
:
i
ssuer
,
ssoI
ssuer
:
ssoI
ssuer
,
ssoURL
:
"http://idp.org/saml/sso"
,
now
:
timeFunc
,
usernameAttr
:
"user"
,
...
...
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