Skip to content

Use "allow_empty_authorization_id" flag to allow AUTHZ_ID=None#47

Open
sravan0x00 wants to merge 1 commit intothobbs:masterfrom
sravan0x00:allow_authz_id_none
Open

Use "allow_empty_authorization_id" flag to allow AUTHZ_ID=None#47
sravan0x00 wants to merge 1 commit intothobbs:masterfrom
sravan0x00:allow_authz_id_none

Conversation

@sravan0x00
Copy link

This commit introduces a flag allow_empty_authorization_id in SASLClient constructor. This flag can be used to set AUTHZ_ID='' during SASL authentication.

Setting this flag will effectively bypass comparison of AUTHN_ID to AUTHZ_ID on server side in cyrus-sasl library, which is currently causing below error in case of a mismatch.

SASL authentication failure: Requested identity not authenticated identity

This is as per SASL RFC section-3.4.1, that states

If the authorization identity string is absent, the client is
requesting to act as the identity the server associates with the
client's credentials.  An empty string is equivalent to an absent
authorization identity.

Allowing empty AUTHZ_ID is the default behavior of most SASL clients in languages like C, Go, Java. By way of doing it via a constructor flag, we make sure we don't break any existing users code.

This also fixes the issue we see with Windows usernames in domain prefixed form CONTOSO\\foobar failing on SASL authorization check (PR#46) and making this library unusable on Windows (and also Kerberos use cases where user principal is like foobar-pkinit@CONTOSO.com).

This commit introduces a flag allow_empty_authorization_id in SASLClient
constructor. This flag can be used to set AUTHZ_ID='' dring SASL AUTH.

Setting this flag will effectively bypass comparision or lookup of
AUTHN_ID to AUTHZ_ID on server side.

This is allowed per RFC and is also the default behaviour most
SASL clients in other langages like C, Go, Java.

This behaviour is as per
[SASL RFC section-3.4.1](https://datatracker.ietf.org/doc/html/rfc4422#section-3.4.1), that states
```
If the authorization identity string is absent, the client is
requesting to act as the identity the server associates with the
client's credentials.  An empty string is equivalent to an absent
authorization identity.
```

This also fixes issue we see with Windows user names in the domain
prefixed form `CONTOSO\\foobar` failing on SASL authorization check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant