cleaned-up code

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/my-vres@142277 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2017-02-06 16:16:59 +00:00
parent 190279c64e
commit 3a7f601c71
3 changed files with 10 additions and 3 deletions

View File

@ -21,6 +21,7 @@ public class MyVREs implements EntryPoint {
public static final String GET_CONTEXT_PARAMETER = "scope"; public static final String GET_CONTEXT_PARAMETER = "scope";
public static final String GET_CLIENT_ID_PARAMETER = "client_id"; public static final String GET_CLIENT_ID_PARAMETER = "client_id";
public static final String GET_CLIENT_SECRET_PARAMETER = "client_secret"; public static final String GET_CLIENT_SECRET_PARAMETER = "client_secret";
public static final String GET_RESPONSE_TYPE_PARAMETER = "response_type";
public static final String GET_AUTH_TOKEN_PARAMETER = "code"; public static final String GET_AUTH_TOKEN_PARAMETER = "code";
@ -53,7 +54,10 @@ public class MyVREs implements EntryPoint {
@Override @Override
public void onSuccess(AuthorizationBean result) { public void onSuccess(AuthorizationBean result) {
if (result.isSuccess()) { if (result.isSuccess()) {
Location.assign(params.redirectURI+"?"+GET_AUTH_TOKEN_PARAMETER+"="+result.getOAuth2TemporaryCode()+"&"+GET_STATE_PARAMETER+"="+result.getState()); Location.assign(params.redirectURI+"?"
+GET_AUTH_TOKEN_PARAMETER+"="+result.getOAuth2TemporaryCode()+"&"
+GET_STATE_PARAMETER+"="+result.getState()+"&"
+GET_RESPONSE_TYPE_PARAMETER+"=code");
} else { } else {
HTML message = new HTML("There were issues in managing this request: " + result.getErrorDescription()); HTML message = new HTML("There were issues in managing this request: " + result.getErrorDescription());
message.setStyleName("portlet-msg-error"); message.setStyleName("portlet-msg-error");

View File

@ -67,7 +67,10 @@ public class ClickableVRE extends HTML {
@Override @Override
public void onSuccess(AuthorizationBean result) { public void onSuccess(AuthorizationBean result) {
if (result.isSuccess()) { if (result.isSuccess()) {
Location.assign(params.getRedirectURI()+"?"+MyVREs.GET_AUTH_TOKEN_PARAMETER+"="+result.getOAuth2TemporaryCode()+"&"+MyVREs.GET_STATE_PARAMETER+"="+result.getState()); Location.assign(params.getRedirectURI()+"?"
+MyVREs.GET_AUTH_TOKEN_PARAMETER+"="+result.getOAuth2TemporaryCode()+"&"
+MyVREs.GET_STATE_PARAMETER+"="+result.getState()+"&"
+MyVREs.GET_RESPONSE_TYPE_PARAMETER+"=code");;
} else { } else {
HTML message = new HTML("There were issues in managing this request: " + result.getErrorDescription()); HTML message = new HTML("There were issues in managing this request: " + result.getErrorDescription());
message.setStyleName("portlet-msg-error"); message.setStyleName("portlet-msg-error");

View File

@ -410,7 +410,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
HttpResponse response = httpClient.execute(httpPostRequest); HttpResponse response = httpClient.execute(httpPostRequest);
responseCode = response.getStatusLine().getStatusCode(); responseCode = response.getStatusLine().getStatusCode();
if (responseCode < 200 || responseCode >= 300) { if (responseCode < 200 || responseCode >= 300) {
_log.error("failed to patch the product. response status line from " _log.error("error: response status line from "
+ fullPath2oAuthService + " was: " + responseCode); + fullPath2oAuthService + " was: " + responseCode);
return false; return false;
} }