msgraph-sdk-java icon indicating copy to clipboard operation
msgraph-sdk-java copied to clipboard

DefaultAllowedHostsValidator does not exist

Open slowcar opened this issue 1 year ago • 2 comments

The upgrade guide https://github.com/microsoftgraph/msgraph-sdk-java/blob/dev/docs/upgrade-to-v6.md#authentication suggests to use DefaultAllowedHostsValidator, but this class cannot be found in the SDK.

As a workaround i used the set from AzureIdentityAccessTokenProvider

slowcar avatar Feb 26 '24 09:02 slowcar

Thanks for reporting this @slowcar. This was a typo. Initializing an AllowedHostsValidator using the set of Graph hosts in AzureIdentityAccessTokenProvider is perfect.

@baywet I'm thinking adding a GraphAllowedHostsValidator would be useful for devs implementing custom token providers for Graph?

Ndiritu avatar Feb 26 '24 11:02 Ndiritu

I think it's a good idea to maximize reusability. However, rather than introducing a derived type, I'd just provide a static method that returns an array/set (whatever matches the API in the language) with the default values. In the case of Java, it'd only be a matter of moving this to a dedicated public static method. Do you want to start coordinating things by creating issues in the core repos for all languages?

baywet avatar Feb 26 '24 14:02 baywet

I just ran into the same problem, please don't forget about this issue. Thanks in advance!

mkomko avatar Jul 23 '24 07:07 mkomko

@mkomko thanks for the nudge here. Authored #2092

baywet avatar Jul 23 '24 11:07 baywet