Skip IAM disabled log for non-IAM tokens

What does this MR do and why?

Authn::Tokens::IamOauthToken.from_jwt logged IAM JWT authentication attempt when disabled for every token it received. This included regular tokens without the gliamat- prefix. When IAM is disabled, the auth log filled up with messages for requests that never used IAM.

This MR checks the gliamat- prefix first. The disabled message is now logged only when an actual IAM token arrives while IAM is disabled.

References

N/A

Screenshots or screen recordings

Not applicable. This is a backend logging change with no UI.

How to set up and validate locally

  1. Make sure IAM auth is disabled.
  2. Make an API request with a regular personal access token.
  3. Check log/auth_json.log. It should not contain IAM JWT authentication attempt when disabled.
  4. Run the spec:
    bin/rspec spec/lib/authn/tokens/iam_oauth_token_spec.rb

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading