Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create PublicClientApplicationConfiguration dynamicly? #1678

Open
NLLAPPS opened this issue Feb 11, 2022 · 0 comments
Open

How to create PublicClientApplicationConfiguration dynamicly? #1678

NLLAPPS opened this issue Feb 11, 2022 · 0 comments

Comments

@NLLAPPS
Copy link

NLLAPPS commented Feb 11, 2022

Hi, I am trying to build PublicClientApplicationConfiguration in Java rather than using json file.
My json config is
` {
"authorities": [
{
"type": "AAD",
"audience": {
"type": "AzureADandPersonalMicrosoftAccount"
},
"default": true
}
],
"account_mode": "SINGLE",
"authorization_user_agent": "WEBVIEW",
"multiple_clouds_supported": true,
"client_id": "XXXXX",
"redirect_uri" : "msauth://XXXXX",
"broker_redirect_uri_registered": true,

"http": {
"connect_timeout": 10000,
"read_timeout": 30000
}
}`

So far I have below but cannot seem to figure out how to set "account_mode": "SINGLE" and "authorization_user_agent": "WEBVIEW" in Java. Where/How would I set those?

            PublicClientApplicationConfiguration publicClientApplicationConfiguration = new PublicClientApplicationConfiguration();

            publicClientApplicationConfiguration.setClientId("XXXXX");
            publicClientApplicationConfiguration.setRedirectUri("msauth://XXXXX");
            publicClientApplicationConfiguration.getHttpConfiguration().setConnectTimeout(10000); 
            publicClientApplicationConfiguration.getHttpConfiguration().setReadTimeout(30000);  
            publicClientApplicationConfiguration.setPowerOptCheckEnabled(false); //Disable so that we can work in background 

            AzureActiveDirectoryAuthority azureActiveDirectoryAuthority = new AzureActiveDirectoryAuthority(new AllAccounts());
            azureActiveDirectoryAuthority.setDefault(true);
            azureActiveDirectoryAuthority.setMultipleCloudsSupported(true);


            publicClientApplicationConfiguration.getAuthorities().add(azureActiveDirectoryAuthority);
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

No branches or pull requests

1 participant