Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Commit

Permalink
fix: append state parameter after imlicit grant response url is forma…
Browse files Browse the repository at this point in the history
…tted

This prevent String.format to interpret %-signs in the state parameter.
For example if state includes a / it will be encoded as %2F and String.format
will try to interpret %2F as a substitution token and fails.
  • Loading branch information
peterrosell committed May 18, 2015
1 parent 446c011 commit 97bb9e9
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -323,8 +323,9 @@ private Response sendErrorResponse(ValidationResponse response) {

private Response sendImplicitGrantResponse(AuthorizationRequest authReq, AccessToken accessToken) {
String uri = authReq.getRedirectUri();
String fragment = String.format("access_token=%s&token_type=bearer&expires_in=%s&scope=%s"
+ appendStateParameter(authReq), accessToken.getToken(), accessToken.getExpiresIn(), StringUtils.join(authReq.getGrantedScopes(), ','));
String fragment = String.format("access_token=%s&token_type=bearer&expires_in=%s&scope=%s",
accessToken.getToken(), accessToken.getExpiresIn(), StringUtils.join(authReq.getGrantedScopes(), ',')) +
appendStateParameter(authReq);
if (authReq.getClient().isIncludePrincipal()) {
fragment += String.format("&principal=%s", authReq.getPrincipal().getDisplayName()) ;
}
Expand Down

0 comments on commit 97bb9e9

Please sign in to comment.