Hello Yair Zaslavsky,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/35299
to review the following change.
Change subject: aaa: Adding auth and principal records on session
......................................................................
aaa: Adding auth and principal records on session
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1163147
Change-Id: Ide92b3832d5007be88465b09a7683bc1034aa6c1
Topic: AAA
Signed-off-by: Yair Zaslavsky <[email protected]>
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/LoginBaseCommand.java
M
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/SessionDataContainer.java
2 files changed, 20 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/35299/1
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/LoginBaseCommand.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/LoginBaseCommand.java
index 86bef2b..896e5b4 100644
---
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/LoginBaseCommand.java
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/LoginBaseCommand.java
@@ -113,7 +113,7 @@
return result;
}
- private boolean attachUserToSession(AuthenticationProfile profile, ExtMap
authRecord) {
+ private boolean attachUserToSession(AuthenticationProfile profile, ExtMap
authRecord, ExtMap principalRecord) {
try {
byte s[] = new byte[64];
SecureRandom.getInstance("SHA1PRNG").nextBytes(s);
@@ -124,7 +124,9 @@
SessionDataContainer.getInstance().setUser(engineSessionId,
getCurrentUser());
SessionDataContainer.getInstance().refresh(engineSessionId);
SessionDataContainer.getInstance().setAuthn(engineSessionId,
profile.getAuthn());
+ SessionDataContainer.getInstance().setAuthRecord(engineSessionId,
authRecord);
SessionDataContainer.getInstance().setPrincipal(engineSessionId,
authRecord.<String>get(Authn.AuthRecord.PRINCIPAL));
+ SessionDataContainer.getInstance().setPrincipalRecord(engineSessionId,
principalRecord);
// Add the user password to the session, as it will be needed later
// when trying to log on to virtual machines:
@@ -316,7 +318,7 @@
principalRecord.<String> get(Authz.PrincipalRecord.NAME)
);
- return attachUserToSession(profile, authRecord);
+ return attachUserToSession(profile, authRecord, principalRecord);
}
private void logEventForUser(String userName, AuditLogType auditLogType) {
diff --git
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/SessionDataContainer.java
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/SessionDataContainer.java
index 6a107d8..7ea494d 100644
---
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/SessionDataContainer.java
+++
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/aaa/SessionDataContainer.java
@@ -185,6 +185,22 @@
return getPrincipalName(sessionId);
}
+ public void setAuthRecord(String engineSessionId, ExtMap authRecord) {
+ setData(engineSessionId, AUTH_RECORD_PARAMETER_NAME, authRecord);
+ }
+
+ public ExtMap getAuthRecord(String engineSessionId) {
+ return (ExtMap) getData(engineSessionId, AUTH_RECORD_PARAMETER_NAME,
false);
+ }
+
+ public void setPrincipalRecord(String engineSessionId, ExtMap
principalRecord) {
+ setData(engineSessionId, PRINCIPAL_RECORD_PARAMETER_NAME,
principalRecord);
+ }
+
+ public ExtMap getPrincipalRecord(String engineSessionId) {
+ return (ExtMap) getData(engineSessionId,
PRINCIPAL_RECORD_PARAMETER_NAME, false);
+ }
+
private void refresh(SessionInfo sessionInfo) {
int softLimitValue = Config.<Integer>
getValue(ConfigValues.UserSessionTimeOutInterval);
if (softLimitValue > 0) {
--
To view, visit http://gerrit.ovirt.org/35299
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide92b3832d5007be88465b09a7683bc1034aa6c1
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches