Skip to content

Commit

Permalink
Merge branch 'master' into yuriyz_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriyz authored Nov 23, 2021
2 parents 7d3a2a5 + 82259c5 commit 63d1c34
Show file tree
Hide file tree
Showing 17 changed files with 324 additions and 229 deletions.
24 changes: 7 additions & 17 deletions client/src/main/java/io/jans/as/client/AuthorizationResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import io.jans.as.model.util.Util;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import javax.ws.rs.core.Response;
import org.json.JSONException;
import org.json.JSONObject;

import javax.ws.rs.core.Response;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
Expand All @@ -30,25 +30,13 @@
import java.util.List;
import java.util.Map;

import static io.jans.as.model.authorize.AuthorizeResponseParam.ACCESS_TOKEN;
import static io.jans.as.model.authorize.AuthorizeResponseParam.AUD;
import static io.jans.as.model.authorize.AuthorizeResponseParam.CODE;
import static io.jans.as.model.authorize.AuthorizeResponseParam.EXP;
import static io.jans.as.model.authorize.AuthorizeResponseParam.EXPIRES_IN;
import static io.jans.as.model.authorize.AuthorizeResponseParam.ID_TOKEN;
import static io.jans.as.model.authorize.AuthorizeResponseParam.ISS;
import static io.jans.as.model.authorize.AuthorizeResponseParam.RESPONSE;
import static io.jans.as.model.authorize.AuthorizeResponseParam.SCOPE;
import static io.jans.as.model.authorize.AuthorizeResponseParam.SESSION_ID;
import static io.jans.as.model.authorize.AuthorizeResponseParam.SID;
import static io.jans.as.model.authorize.AuthorizeResponseParam.STATE;
import static io.jans.as.model.authorize.AuthorizeResponseParam.TOKEN_TYPE;
import static io.jans.as.model.authorize.AuthorizeResponseParam.*;

/**
* Represents an authorization response received from the authorization server.
*
* @author Javier Rojas Blum
* @version July 28, 2021
* @version November 22, 2021
*/
public class AuthorizationResponse extends BaseResponse {

Expand Down Expand Up @@ -169,8 +157,10 @@ private void processLocation() {
byte[] sharedSymmetricKey = sharedKey != null ? sharedKey.getBytes(StandardCharsets.UTF_8) : null;
Jwe jwe = Jwe.parse(response, privateKey, sharedSymmetricKey);

for (Map.Entry<String, List<String>> entry : jwe.getClaims().toMap().entrySet()) {
params.put(entry.getKey(), entry.getValue().get(0));
if (jwe != null) {
for (Map.Entry<String, List<String>> entry : jwe.getClaims().toMap().entrySet()) {
params.put(entry.getKey(), entry.getValue().get(0));
}
}
} else {
Jwt jwt = Jwt.parse(response);
Expand Down
4 changes: 1 addition & 3 deletions client/src/main/java/io/jans/as/client/ClientInfoClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,8 @@ private ClientInfoResponse execInternal() {

setResponse(new ClientInfoResponse(clientResponse));

String entity = clientResponse.readEntity(String.class);
getResponse().setEntity(entity);
getResponse().setHeaders(clientResponse.getMetadata());
parseEntity(entity);
parseEntity(getResponse().getEntity());
} catch (Exception e) {
LOG.error(e.getMessage(), e);
} finally {
Expand Down
2 changes: 0 additions & 2 deletions client/src/main/java/io/jans/as/client/RegisterResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ public RegisterResponse() {
public RegisterResponse(Response clientResponse) {
super(clientResponse);

String entity = clientResponse.readEntity(String.class);
setEntity(entity);
setHeaders(clientResponse.getMetadata());
injectDataFromJson(entity);
}
Expand Down
4 changes: 1 addition & 3 deletions client/src/main/java/io/jans/as/client/UserInfoClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ public UserInfoResponse exec() {

setResponse(new UserInfoResponse(clientResponse));

String entity = clientResponse.readEntity(String.class);
getResponse().setEntity(entity);
getResponse().setHeaders(clientResponse.getMetadata());
parseEntity(entity);
parseEntity(getResponse().getEntity());
} catch (Exception e) {
LOG.error(e.getMessage(), e);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public class FirebaseCloudMessagingResponse extends BaseResponse {
public FirebaseCloudMessagingResponse(Response clientResponse) {
super(clientResponse);

String entity = clientResponse.readEntity(String.class);
setEntity(entity);
setHeaders(clientResponse.getMetadata());
injectDataFromJson(entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public class PingCallbackResponse extends BaseResponse {
public PingCallbackResponse(Response clientResponse) {
super(clientResponse);

String entity = clientResponse.readEntity(String.class);
setEntity(entity);
setHeaders(clientResponse.getMetadata());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public class PushErrorResponse extends BaseResponse {
public PushErrorResponse(Response clientResponse) {
super(clientResponse);

String entity = clientResponse.readEntity(String.class);
setEntity(entity);
setHeaders(clientResponse.getMetadata());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public class PushTokenDeliveryResponse extends BaseResponse {
public PushTokenDeliveryResponse(Response clientResponse) {
super(clientResponse);

String entity = clientResponse.readEntity(String.class);
setEntity(entity);
setHeaders(clientResponse.getMetadata());
}
}
Loading

0 comments on commit 63d1c34

Please sign in to comment.