Add option to pass in instance discovery response#156
Conversation
There was a problem hiding this comment.
in description you mentioned that metadata can be requested from https://{host}/common/discovery/instance and provided to app, but as i understand form previous conversation this endpoint is not available in region specific configs.
@SomkaPe This is a good point. I will update the wiki page with instructions for region specific configuration. |
|
|
||
| @Accessors(fluent = true) | ||
| @Getter | ||
| private InstanceDiscoveryResponse instanceDiscoveryResponse; |
There was a problem hiding this comment.
I would rename to AADInstanceDiscoveryResponse because it is only relevant for AAD authorities,
so not for B2C or ADFS
|
If Instance Discovery Response set manually, during construction of application object we might want to check "validate authority" flag, and throw Exception if it is true. "Authority validation" feature is essentially check that authority is known to AAD (we do it by issuing instance discovery request to hardcoded AAD endpoint). Also we should discuss option of throwing exception if application object is configured with ADFS or B2C authority and "validate authority" flag is set as true. |
| validate(instanceDiscoveryResponse); | ||
|
|
||
| } catch(Exception ex){ | ||
| throw new MsalClientException("Error parsing instance discovery response. Data must be" + |
There was a problem hiding this comment.
What needs more spaces? The error message?
There was a problem hiding this comment.
I see, will update
|
@SomkaPe - In the end, what we want to protect against is the user calling an hacked IdP. But in 99% of the cases, the authority is hardcoded, I have yet to see applications that call an API, get a 401, extract the authority blindly and start talking to it. As such, in my opinion, we should not throw if the user doesn't set ValidateAuthority properly, i.e. for B2C So the general algorithm is:
|
|
I agree that we should get rid of @SomkaPe Instead of throwing exception, the other would be to clearly document in the |
Java Doc might be good enough, ... only be validated if it's an AAD/ADFS authority - may be if it is AAD authority |
|
|
After further discussion, we decided not to merge #149 due to:
This PR adds the option for developer to pass in instance discovery metadata, and meets the same functional requirements. Accompanying wiki post at https://aka.ms/msal4j-instance-discovery