forked from mystiq/dex
Merge pull request #985 from zlabjp/avoid-id-beginning-with-number
bugfix: avoid generating an invalid ID attribute in SAML's AuthenRequest element
This commit is contained in:
commit
377d9b44b7
1 changed files with 2 additions and 2 deletions
|
@ -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.
|
||||||
|
|
Loading…
Reference in a new issue