@@ -223,7 +223,7 @@ func ParseAndValidateOIDCToken(ctx context.Context, accessToken string, keycloak
223
223
}
224
224
225
225
if ! jot .AssertMatchingAudience (audienceRequired ) {
226
- logger .Info (ctx , "msg" , "Authorization error: Incorrect audience" )
226
+ logger .Info (ctx , "msg" , "Authorization error: Incorrect audience" , "audience" , jot . GetAudience () )
227
227
return nil , security.ForbiddenError {}
228
228
}
229
229
@@ -297,6 +297,7 @@ type TokenAudience interface {
297
297
GetUsername () string
298
298
GetIssuer () string
299
299
GetGroups () []string
300
+ GetAudience () any
300
301
301
302
AssertMatchingAudience (requiredValue string ) bool
302
303
}
@@ -341,6 +342,9 @@ func (ta *TokenAudienceStringArray) GetIssuer() string { return ta.Issuer }
341
342
// GetGroups provides the groups from the token
342
343
func (ta * TokenAudienceStringArray ) GetGroups () []string { return ta .Groups }
343
344
345
+ // GetAudience provides the audience from the token
346
+ func (ta * TokenAudienceStringArray ) GetAudience () any { return ta .Audience }
347
+
344
348
// AssertMatchingAudience checks if the required audience is in the token list of audiences
345
349
func (ta * TokenAudienceStringArray ) AssertMatchingAudience (requiredValue string ) bool {
346
350
return AssertMatchingAudience (ta .Audience , requiredValue )
@@ -358,6 +362,9 @@ func (ta *TokenAudienceString) GetIssuer() string { return ta.Issuer }
358
362
// GetGroups provides the groups from the token
359
363
func (ta * TokenAudienceString ) GetGroups () []string { return ta .Groups }
360
364
365
+ // GetAudience provides the audience from the token
366
+ func (ta * TokenAudienceString ) GetAudience () any { return ta .Audience }
367
+
361
368
// AssertMatchingAudience checks if the required audience is in the token list of audiences
362
369
func (ta * TokenAudienceString ) AssertMatchingAudience (requiredValue string ) bool {
363
370
return ta .Audience == requiredValue
0 commit comments