Commit 377d9b44 authored by rithu leena john's avatar rithu leena john Committed by GitHub

Merge pull request #985 from zlabjp/avoid-id-beginning-with-number

bugfix: avoid generating an invalid ID attribute in SAML's AuthenRequest element
parents a5d218fd cc314690
...@@ -30,8 +30,8 @@ func NewID() string { ...@@ -30,8 +30,8 @@ func NewID() string {
if _, err := io.ReadFull(rand.Reader, buff); err != nil { if _, err := io.ReadFull(rand.Reader, buff); err != nil {
panic(err) panic(err)
} }
// Trim padding // Avoid the identifier to begin with number and trim padding
return strings.TrimRight(encoding.EncodeToString(buff), "=") return string(buff[0]%26+'a') + strings.TrimRight(encoding.EncodeToString(buff[1:]), "=")
} }
// GCResult returns the number of objects deleted by garbage collection. // GCResult returns the number of objects deleted by garbage collection.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment