question

JL12345 avatar image
2 Votes"
JL12345 asked FrederikKrautwald-7657 commented

B2C wildcards in redirect uri?

Hi,

We are looking to migrate our platform to b2c.

Each of our customer are allocated their own subdomain,
eg, disney.finance.mycompany.com, atlassian.finance.mycompany.com

We have about 500 such subdomains/customers to date.

In our previous provider, we configure the app redirect to accept wildcard for our subdomain: *.finance.mycompany.com

How can we achieve the same thing with b2c?

I have tried to modify the manifest file for the application, but it doesn't work.

thanks

azure-ad-b2c
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

soumi-MSFT avatar image
0 Votes"
soumi-MSFT answered FrederikKrautwald-7657 commented

@JL12345, Wildcard redirect uris are something that are not supported by AAD or AAD B2C. One of the reasons behind this restriction is the security threat called Open Redirector. You can read more about this threat here:
https://www.rfc-editor.org/rfc/rfc6819#section-4.1.5
https://www.rfc-editor.org/rfc/rfc6819#section-4.2.4

You can find the mitigation steps mentioned here: https://www.rfc-editor.org/rfc/rfc6819#section-5.2.3.5

Also, you can check the following url to understand the various restrictions that are imposed on the redirect uris in AAD and AAD B2C: https://docs.microsoft.com/en-us/azure/active-directory/develop/reply-url#maximum-number-of-redirect-uris

You can certainly add all the subdomains as a separate Redirect URI, but then that too has a limit of 256 redirect uris as listed here: https://docs.microsoft.com/en-us/azure/active-directory/develop/reply-url#maximum-number-of-redirect-uris


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the reply.

In this case, what are my options, if I 1) can't use wildcard, and 2)have a limit of 256 redirect uris?

From the link about reply-url, it mentions using the state parameter and a shared redirect uri:

If you have several subdomains and your scenario requires that, upon successful authentication, you redirect users to the same page from which they started, using a state parameter might be helpful.

Does it mean:
1. when a user needs to sign in from a subdomain (eg, disney.finance.mycompany.com):
2. the subdomain initiates the sign in flow by sending the user to b2c, and specifies a shared redirect uri and some state info (ie, subdomain)
3. after the user authenticates, they are redirected to the shared redirect uri
4. The shared redirect uri is configured to extract the security tokens and read the state (subdomain)
5. The shared redirect uri then redirects the user back to the subdomain with the security tokens.

Is my understanding correct?

Do you have any example code for this ?
(example where a shared redirect uri service implementation extracts the token, reads the encoded state, and redirects the user back to the subdomain to complete the sign in?)

Is this achievable using the msaljs library?


Thanks!

3 Votes 3 ·

I would also like some more information on using a state parameter with MSALJS.

0 Votes 0 ·