You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-06-23 00:40:46 +02:00
Handle UPN fallback when profileURL isn't set
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
@ -253,6 +254,16 @@ var _ = Describe("ADFS Provider Tests", func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session.Email).To(Equal("upn@company.com"))
|
||||
})
|
||||
|
||||
It("falls back to UPN claim on errors", func() {
|
||||
p.oidcEnrichFunc = func(_ context.Context, s *sessions.SessionState) error {
|
||||
return errors.New("neither the id_token nor the profileURL set an email")
|
||||
}
|
||||
|
||||
err := p.EnrichSession(context.Background(), session)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session.Email).To(Equal("upn@company.com"))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("RefreshSession", func() {
|
||||
|
Reference in New Issue
Block a user