Shave off an IAM lookup if the user is the anonymous user (#305)
* Shave off an IAM lookup if the user is the anonymous user * Fix build * If authz failures are turned off, make the token type unknown instead of invalid * Change returned token format when authz failures are disabled * Change logic back * Fix logic
This commit is contained in:
1 parent
b53812a5c1
commit
274afa6b02
2 files changed
+41
-21
No files matched your search
@@ -207,8 +207,12 @@ func wrapHandlerWithCommonFuncs(h http.Handler, c *Controller, props HandlerProp
|
||||
|
||||
requestInfo.PublicId, requestInfo.Token, requestInfo.TokenFormat = auth.GetTokenFromRequest(c.logger, c.kms, r)
|
||||
if requestInfo.TokenFormat == auth.AuthTokenTypeInvalid {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
return
|
||||
if disableAuthzFailures {
|
||||
requestInfo.TokenFormat = auth.AuthTokenTypeBearer
|
||||
} else {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
ctx = auth.NewVerifierContext(ctx, c.logger, c.IamRepoFn, c.AuthTokenRepoFn, c.ServersRepoFn, c.kms, requestInfo)
|
||||
|
||||
|
||||
Reference in new issue
Block a user