我在我的應用程序中使用MFP8。我正在使用安全檢查框架來驗證用戶。爲了驗證用戶,我正在使用一些後端圖層來驗證用戶。一旦用戶驗證我的後端服務將返回巨大的JSON。現在我需要將此響應發送給客戶端。安全檢查後IBM MFP8 Respnse
PFB我在UserLogin適配器中試過的代碼。來自後端層的響應是JSON格式非常巨大的響應(75-80KB)。請幫助如何將這種響應從安檢發送到客戶端
P.S:
public class UserLoginResource extends UserAuthenticationSecurityCheck {
private String userId, displayName,errorMsg, cdata, hdata, rid, urlParams, serviceName, queryParameters;
private boolean rememberMe = false;
private boolean authFlag=true;
public static JSONObject queryResponse;
private Map<String, Object> attributes = new HashMap<String, Object>();
@Context
AdapterSecurityContext adapterSecurityContext;
@Override
protected AuthenticatedUser createUser() {
System.out.println("User Authenticated Result "+ userId);
return new AuthenticatedUser(userId, displayName, this.getName(), attributes);
}
@Override
protected boolean validateCredentials(Map<String, Object> credentials) {
try{
String username=credentials.get("username").toString();
String password = credentials.get("password").toString(); ;
if (username != null && password != null) {
queryResponse = <my backend layer>(username, password);
if(queryResponse.errorExist){
System.out.println("User Authentication Failed");
errorMsg="User Authentication Failed";
return false;
}
else{
System.out.println("User Authentication Sucessful");
userId=queryResponse.userid;
displayName=queryResponse.fullname;
attributes.put("queryParams", queryResponse.toString());
authFlag=false;
errorMsg = null;
return true;
}
}
}
catch(Exception e){
e.printStackTrace();
authFlag =true;
return false;
}
return false;
}
}