You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-08-10 22:51:31 +02:00
Ensure claim extractor does not attempt profile call when URL is empty
This commit is contained in:
@@ -259,6 +259,24 @@ var _ = Describe("Claim Extractor Suite", func() {
|
||||
Expect(counter).To(BeEquivalentTo(1))
|
||||
})
|
||||
|
||||
It("GetClaim should not return an error with a non-nil empty ProfileURL", func() {
|
||||
claims, serverClose, err := newTestClaimExtractor(testClaimExtractorOpts{
|
||||
idTokenPayload: "{}",
|
||||
profileRequestHeaders: newAuthorizedHeader(),
|
||||
})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
if serverClose != nil {
|
||||
defer serverClose()
|
||||
}
|
||||
// Set the ProfileURL to be empty, but not nil
|
||||
claims.(*claimExtractor).profileURL = &url.URL{}
|
||||
|
||||
value, exists, err := claims.GetClaim("user")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(exists).To(BeFalse())
|
||||
Expect(value).To(BeNil())
|
||||
})
|
||||
|
||||
type getClaimIntoTableInput struct {
|
||||
testClaimExtractorOpts
|
||||
into interface{}
|
||||
|
Reference in New Issue
Block a user