Skip to content

Commit

Permalink
Merge 51f7ca7 into f79315e
Browse files Browse the repository at this point in the history
  • Loading branch information
sameerag committed Dec 17, 2019
2 parents f79315e + 51f7ca7 commit 4a8e019
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/msal-core/src/UserAgentApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,27 @@ export class UserAgentApplication {
});
}

/**
* API interfacing idToken request when applications already have a session/hint acquired by authorization client applications
* @param request
*/
ssoSilent(request: AuthenticationParameters): Promise<AuthResponse> {
// throw an error on an empty request
if (!request) {
throw ClientConfigurationError.createEmptyRequestError();
}

// throw an error on no hints passed
if(!request.sid || !request.loginHint) {
throw ClientConfigurationError.createSsoSilentError();
}

return this.acquireTokenSilent({
...request,
scopes: [this.clientId]
});
}

/**
* Use this function to obtain a token before every call to the API / resource provider
*
Expand Down Expand Up @@ -640,6 +661,7 @@ export class UserAgentApplication {
this.logger.verbose("ADAL's idToken exists. Extracting login information from ADAL's idToken ");
serverAuthenticationRequest.populateQueryParams(account, null, adalIdTokenObject);
}

const userContainedClaims = request.claimsRequest || serverAuthenticationRequest.claimsValue;

let authErr: AuthError;
Expand Down
9 changes: 9 additions & 0 deletions lib/msal-core/src/error/ClientConfigurationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ export const ClientConfigurationErrorMessage = {
telemetryConfigError: {
code: "telemetry_config_error",
desc: "Telemetry config is not configured with required values"
},
ssoSilentError: {
code: "sso_silent_error",
desc: "pass sid or login_hint for ssoSilent"
}
};

Expand Down Expand Up @@ -169,4 +173,9 @@ export class ClientConfigurationError extends ClientAuthError {

return new ClientConfigurationError(code, `${desc} mising values: ${missingKeys.join(",")}`);
}

static createSsoSilentError(): ClientConfigurationError {
return new ClientConfigurationError(ClientConfigurationErrorMessage.ssoSilentError.code,
ClientConfigurationErrorMessage.ssoSilentError.desc);
}
}

0 comments on commit 4a8e019

Please sign in to comment.