public MSALClientWrapper()

in src/CsrValidation/java/lib/src/main/java/com/microsoft/intune/scepvalidation/MSALClientWrapper.java [57:95]


    public MSALClientWrapper(String aadTenant, Properties props) throws IllegalArgumentException
    {
        if(aadTenant == null || aadTenant.isEmpty())
        {
            throw new IllegalArgumentException("The argument 'aadTenant' is missing");
        }
        
        if(props == null)
        {
            throw new IllegalArgumentException("The argument 'props' is missing");
        }
        
        this.authority = props.getProperty("AUTH_AUTHORITY",this.authority);
        
        this.azureAppId = props.getProperty("AAD_APP_ID");
        if(this.azureAppId == null || this.azureAppId.isEmpty())
        {
            throw new IllegalArgumentException("The argument 'AAD_APP_ID' is missing");
        }
        
        String azureAppKey = props.getProperty("AAD_APP_KEY");
        if(azureAppKey == null || azureAppKey.isEmpty())
        {
            throw new IllegalArgumentException("The argument 'AAD_APP_KEY' is missing");
        }
        
        this.service = Executors.newFixedThreadPool(1);

        try 
        {
            builder = ConfidentialClientApplication
                    .builder(azureAppId, ClientCredentialFactory.createFromSecret(azureAppKey))
                    .authority(authority + aadTenant);
        }
        catch(MalformedURLException e)
        {
            throw new IllegalArgumentException("AUTH_AUTHORITY parameter was not formatted correctly which resulted in a MalformedURLException", e);
        }
    }