Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
go-sso
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
id
go-sso
Commits
10356d24
Commit
10356d24
authored
7 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Validate should ignore the ticket nonce when called with empty nonce
parent
3a27b01f
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
sso.go
+37
-12
37 additions, 12 deletions
sso.go
with
37 additions
and
12 deletions
sso.go
+
37
−
12
View file @
10356d24
...
...
@@ -11,18 +11,43 @@ import (
)
var
(
// Errors.
ErrMissingRequiredField
=
errors
.
New
(
"missing required field"
)
ErrBadNonceLength
=
errors
.
New
(
"bad nonce length"
)
ErrDeserialization
=
errors
.
New
(
"deserialization error"
)
// ErrMissingRequiredField is returned when a ticket does not
// contain a required field.
ErrMissingRequiredField
=
errors
.
New
(
"missing required field"
)
// ErrDeserialization means that the input is not valid base64.
ErrDeserialization
=
errors
.
New
(
"deserialization error"
)
// ErrUnsupportedTicketVersion is returned for unsupported
// ticket versions (either too old or too recent).
ErrUnsupportedTicketVersion
=
errors
.
New
(
"unsupported ticket version"
)
ErrMessageTooShort
=
errors
.
New
(
"encoded message too short"
)
ErrBadSignature
=
errors
.
New
(
"bad signature"
)
ErrBadService
=
errors
.
New
(
"service mismatch"
)
ErrBadDomain
=
errors
.
New
(
"auth domain mismatch"
)
ErrBadNonce
=
errors
.
New
(
"nonce mismatch"
)
ErrExpired
=
errors
.
New
(
"ticket expired"
)
ErrUnauthorized
=
errors
.
New
(
"unauthorized"
)
// ErrMessageTooShort means that the input is shorter than the
// fixed signature length + minimum ticket size.
ErrMessageTooShort
=
errors
.
New
(
"encoded message too short"
)
// ErrBadSignature is returned when the signature does not
// match the given public key.
ErrBadSignature
=
errors
.
New
(
"bad signature"
)
// ErrBadService is returned when validation fails due to a
// SSO service mismatch.
ErrBadService
=
errors
.
New
(
"service mismatch"
)
// ErrBadDomain is returned when validation fails due to a SSO
// domain mismatch.
ErrBadDomain
=
errors
.
New
(
"auth domain mismatch"
)
// ErrBadNonce is returned when validation fails due to a
// nonce mismatch.
ErrBadNonce
=
errors
.
New
(
"nonce mismatch"
)
// ErrExpired means the ticket has expired.
ErrExpired
=
errors
.
New
(
"ticket expired"
)
// ErrUnauthorized is returned when the user lacks the
// necessary group membership.
ErrUnauthorized
=
errors
.
New
(
"unauthorized"
)
)
const
(
...
...
@@ -234,7 +259,7 @@ func (v *ssoValidator) Validate(encoded, nonce, service string, allowedGroups []
if
t
.
Expires
.
Before
(
time
.
Now
())
{
return
nil
,
ErrExpired
}
if
t
.
Nonce
!=
nonce
{
if
nonce
!=
""
&&
t
.
Nonce
!=
nonce
{
return
nil
,
ErrBadNonce
}
...
...
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