Skip to content
Snippets Groups Projects
Commit 10356d24 authored by ale's avatar ale
Browse files

Validate should ignore the ticket nonce when called with empty nonce

parent 3a27b01f
Branches
Tags
No related merge requests found
...@@ -11,18 +11,43 @@ import ( ...@@ -11,18 +11,43 @@ import (
) )
var ( var (
// Errors. // ErrMissingRequiredField is returned when a ticket does not
ErrMissingRequiredField = errors.New("missing required field") // contain a required field.
ErrBadNonceLength = errors.New("bad nonce length") ErrMissingRequiredField = errors.New("missing required field")
ErrDeserialization = errors.New("deserialization error")
// 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") ErrUnsupportedTicketVersion = errors.New("unsupported ticket version")
ErrMessageTooShort = errors.New("encoded message too short")
ErrBadSignature = errors.New("bad signature") // ErrMessageTooShort means that the input is shorter than the
ErrBadService = errors.New("service mismatch") // fixed signature length + minimum ticket size.
ErrBadDomain = errors.New("auth domain mismatch") ErrMessageTooShort = errors.New("encoded message too short")
ErrBadNonce = errors.New("nonce mismatch")
ErrExpired = errors.New("ticket expired") // ErrBadSignature is returned when the signature does not
ErrUnauthorized = errors.New("unauthorized") // 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 ( const (
...@@ -234,7 +259,7 @@ func (v *ssoValidator) Validate(encoded, nonce, service string, allowedGroups [] ...@@ -234,7 +259,7 @@ func (v *ssoValidator) Validate(encoded, nonce, service string, allowedGroups []
if t.Expires.Before(time.Now()) { if t.Expires.Before(time.Now()) {
return nil, ErrExpired return nil, ErrExpired
} }
if t.Nonce != nonce { if nonce != "" && t.Nonce != nonce {
return nil, ErrBadNonce return nil, ErrBadNonce
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment