authorize: fix headers when impersonating

- Add user impersonation docs.
- Add navbar link to v0.0.5 docs.
This commit is contained in:
Bobby DeSimone 2019-06-11 15:40:28 -07:00
parent fb92466f45
commit 554e62108f
No known key found for this signature in database
GPG key ID: AEE4CF12FE86D07E
8 changed files with 134 additions and 21 deletions

View file

@ -36,6 +36,28 @@ func (s *SessionState) RefreshPeriodExpired() bool {
return isExpired(s.RefreshDeadline)
}
// Impersonating returns if the request is impersonating.
func (s *SessionState) Impersonating() bool {
return s.ImpersonateEmail != "" || len(s.ImpersonateGroups) != 0
}
// RequestEmail is the email to make the request as.
func (s *SessionState) RequestEmail() string {
if s.ImpersonateEmail != "" {
return s.ImpersonateEmail
}
return s.Email
}
// RequestGroups returns the groups of the Groups making the request; uses
// impersonating user if set.
func (s *SessionState) RequestGroups() string {
if len(s.ImpersonateGroups) != 0 {
return strings.Join(s.ImpersonateGroups, ",")
}
return strings.Join(s.Groups, ",")
}
type idToken struct {
Issuer string `json:"iss"`
Subject string `json:"sub"`