This is an automated email from the ASF dual-hosted git repository.
smckinney pushed a commit to branch FC-265
in repository https://gitbox.apache.org/repos/asf/directory-fortress-enmasse.git
The following commit(s) were added to refs/heads/FC-265 by this push:
new 0bb634a add a switch to turn on / off arbac02 checks.
0bb634a is described below
commit 0bb634a519302aed0e585ee0be5c6974b92ef0b5
Author: Shawn McKinney <smckinney@apache.org>
AuthorDate: Sat Mar 16 09:13:41 2019 -0500
add a switch to turn on / off arbac02 checks.
---
.../apache/directory/fortress/rest/SecUtils.java | 29 ++++++++++------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/src/main/java/org/apache/directory/fortress/rest/SecUtils.java b/src/main/java/org/apache/directory/fortress/rest/SecUtils.java
index 4d3981a..ac8be84 100644
--- a/src/main/java/org/apache/directory/fortress/rest/SecUtils.java
+++ b/src/main/java/org/apache/directory/fortress/rest/SecUtils.java
@@ -71,10 +71,7 @@ public class SecUtils
if (httpRequest == null)
{
// Improper container config.
- fortResponse = new FortResponse();
- fortResponse.setErrorCode(GlobalErrIds.REST_NULL_HTTP_REQ_ERR);
- fortResponse.setErrorMessage("initializeSession detected null HTTP Request");
- fortResponse.setHttpStatus(403);
+ fortResponse = createError( GlobalErrIds.REST_NULL_HTTP_REQ_ERR, "initializeSession
detected null HTTP Request", 403);
}
else
{
@@ -91,26 +88,26 @@ public class SecUtils
}
else
{
- String error = "initializeSession couldn't get a Security Session.";
- fortResponse = new FortResponse();
- fortResponse.setErrorCode(GlobalErrIds.USER_SESS_NULL);
- fortResponse.setErrorMessage(error);
- fortResponse.setHttpStatus(403);
- LOG.info(error);
+ fortResponse = createError( GlobalErrIds.USER_SESS_NULL, "initializeSession
couldn't get a Security Session.", 403);
}
}
catch (SecurityException se)
{
// A problem deserializing the security principal.
- String error = "initializeSession caught SecurityException=" + se.getMessage();
- fortResponse = new FortResponse();
- LOG.info(error);
- fortResponse.setErrorCode(se.getErrorId());
- fortResponse.setErrorMessage(error);
- fortResponse.setHttpStatus(se.getHttpStatus());
+ fortResponse = createError( se.getErrorId(), "initializeSession caught
SecurityException=" + se.getMessage(), se.getHttpStatus());
}
}
}
return fortResponse;
}
+
+ private static FortResponse createError(int errId, String errMsg, int hCode)
+ {
+ FortResponse fortResponse = new FortResponse();
+ fortResponse.setErrorCode(errId);
+ fortResponse.setErrorMessage(errMsg);
+ fortResponse.setHttpStatus(hCode);
+ LOG.info(errMsg);
+ return fortResponse;
+ }
}
\ No newline at end of file
|