aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-05-05 16:16:30 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-05-05 16:16:30 +0200
commitb254147e749282209ffc625f4931e748a5e8be7c (patch)
tree3cc5d649c33f18c2da9e62e08214f3bde3b1bb86 /id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java
parentead506b950a862750ff361262dca82d96cdaea47 (diff)
downloadmoa-id-spss-b254147e749282209ffc625f4931e748a5e8be7c.tar.gz
moa-id-spss-b254147e749282209ffc625f4931e748a5e8be7c.tar.bz2
moa-id-spss-b254147e749282209ffc625f4931e748a5e8be7c.zip
refectore AuthenticatedUser
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java172
1 files changed, 99 insertions, 73 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java
index b7da86db7..330ed7036 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/AuthenticatedUser.java
@@ -24,6 +24,9 @@ package at.gv.egovernment.moa.id.configuration.auth;
import java.util.Date;
+import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
+import at.gv.egovernment.moa.id.configuration.Constants;
+import at.gv.egovernment.moa.id.configuration.data.UserDatabaseFrom;
import at.gv.egovernment.moa.id.configuration.helper.DateTimeHelper;
public class AuthenticatedUser {
@@ -39,27 +42,89 @@ public class AuthenticatedUser {
private String institute;
private String userName;
private Date lastLogin;
-
- public AuthenticatedUser() {
+
+ private boolean onlyBusinessService = false;
+ private String businessServiceType;
+ private String businessServiceNumber;
+
+ private AuthenticatedUser() {
}
- public AuthenticatedUser(long userID, String givenName, String familyName, String institute,
- String userName, boolean isAuthenticated, boolean isAdmin, boolean isMandateUser,
+ public static AuthenticatedUser generateDefaultUser() {
+
+ AuthenticatedUser user = new AuthenticatedUser();
+ user.familyName = "TestUser";
+ user.givenName = "Max";
+ user.userName = "maxtestuser";
+ user.userID = 0;
+ user.institute = new String();
+ user.isAdmin = true;
+ user.isAuthenticated = true;
+ user.isMandateUser = false;
+ user.isPVP2Login = false;
+ user.lastLogin = new Date();
+
+ return user;
+ }
+
+ public static AuthenticatedUser generateUserRequestUser(UserDatabaseFrom form) {
+
+ AuthenticatedUser user = new AuthenticatedUser();
+ user.familyName = form.getFamilyName();
+ user.givenName = form.getGivenName();
+ user.userName = form.getUsername();
+ user.userID = 0;
+ user.institute = form.getInstitut();
+ user.isAdmin = false;
+ user.isAuthenticated = false;
+ user.isMandateUser = form.isIsmandateuser();
+ user.isPVP2Login = form.isPVPGenerated();
+ user.lastLogin = new Date();
+
+ return user;
+ }
+
+ public AuthenticatedUser(UserDatabase userdb, boolean isAuthenticated, boolean isMandateUser,
boolean isPVP2Login) {
- this.familyName = familyName;
- this.givenName = givenName;
- this.userName = userName;
- this.userID = userID;
- this.institute = institute;
- this.isAdmin = isAdmin;
+ this.familyName = userdb.getFamilyname();
+ this.givenName = userdb.getGivenname();
+ this.userName = userdb.getUsername();
+ this.userID = userdb.getHjid();
+ this.institute = userdb.getInstitut();
+ this.isAdmin = userdb.isIsAdmin();
this.isAuthenticated = isAuthenticated;
this.isMandateUser = isMandateUser;
this.isPVP2Login = isPVP2Login;
this.lastLogin = new Date();
+
+ if (!this.isAdmin) generateUserSpecificConfigurationOptions(userdb);
}
+
+ private void generateUserSpecificConfigurationOptions(UserDatabase userdb) {
+
+ if (userdb.isIsMandateUser() != null && userdb.isIsMandateUser()) {
+ String bpk = userdb.getBpk();
+ if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN) || bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_ZVR) || bpk.startsWith(Constants.IDENIFICATIONTYPE_STORK)) {
+ onlyBusinessService = true;
+
+ String[] split = bpk.split("\\+");
+ this.businessServiceType = split[1].substring(1);
+
+ if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN))
+ this.businessServiceNumber = at.gv.egovernment.moa.util.StringUtils.deleteLeadingZeros(split[2]);
+ else
+ this.businessServiceNumber = split[2];
+
+ } else
+ onlyBusinessService = false;
+
+ }
+
+ }
+
public String getFormatedLastLogin() {
return DateTimeHelper.getDateTime(lastLogin);
}
@@ -72,13 +137,6 @@ public class AuthenticatedUser {
}
/**
- * @param isAuthenticated the isAuthenticated to set
- */
- public void setAuthenticated(boolean isAuthenticated) {
- this.isAuthenticated = isAuthenticated;
- }
-
- /**
* @return the isAdmin
*/
public boolean isAdmin() {
@@ -86,13 +144,6 @@ public class AuthenticatedUser {
}
/**
- * @param isAdmin the isAdmin to set
- */
- public void setAdmin(boolean isAdmin) {
- this.isAdmin = isAdmin;
- }
-
- /**
* @return the userID
*/
public long getUserID() {
@@ -100,13 +151,6 @@ public class AuthenticatedUser {
}
/**
- * @param userID the userID to set
- */
- public void setUserID(long userID) {
- this.userID = userID;
- }
-
- /**
* @return the givenName
*/
public String getGivenName() {
@@ -114,13 +158,6 @@ public class AuthenticatedUser {
}
/**
- * @param givenName the givenName to set
- */
- public void setGivenName(String givenName) {
- this.givenName = givenName;
- }
-
- /**
* @return the familyName
*/
public String getFamilyName() {
@@ -128,25 +165,11 @@ public class AuthenticatedUser {
}
/**
- * @param familyName the familyName to set
- */
- public void setFamilyName(String familyName) {
- this.familyName = familyName;
- }
-
- /**
* @return the lastLogin
*/
public Date getLastLogin() {
return lastLogin;
}
-
- /**
- * @param lastLogin the lastLogin to set
- */
- public void setLastLogin(Date lastLogin) {
- this.lastLogin = lastLogin;
- }
/**
* @return the userName
@@ -156,54 +179,57 @@ public class AuthenticatedUser {
}
/**
- * @param userName the userName to set
+ * @return the institute
*/
- public void setUserName(String userName) {
- this.userName = userName;
+ public String getInstitute() {
+ return institute;
}
/**
- * @return the institute
+ * @return the isPVP2Login
*/
- public String getInstitute() {
- return institute;
+ public boolean isPVP2Login() {
+ return isPVP2Login;
}
/**
- * @param institute the institute to set
+ * @return the isMandateUser
*/
- public void setInstitute(String institute) {
- this.institute = institute;
+ public boolean isMandateUser() {
+ return isMandateUser;
}
/**
- * @return the isPVP2Login
+ * @return the onlyBusinessService
*/
- public boolean isPVP2Login() {
- return isPVP2Login;
+ public boolean isOnlyBusinessService() {
+ return onlyBusinessService;
}
/**
- * @param isPVP2Login the isPVP2Login to set
+ * @return the businessServiceType
*/
- public void setPVP2Login(boolean isPVP2Login) {
- this.isPVP2Login = isPVP2Login;
+ public String getBusinessServiceType() {
+ return businessServiceType;
}
/**
- * @return the isMandateUser
+ * @return the businessServiceNumber
*/
- public boolean isMandateUser() {
- return isMandateUser;
+ public String getBusinessServiceNumber() {
+ return businessServiceNumber;
}
/**
- * @param isMandateUser the isMandateUser to set
+ * @param lastLogin the lastLogin to set
*/
- public void setMandateUser(boolean isMandateUser) {
- this.isMandateUser = isMandateUser;
+ public void setLastLogin(Date lastLogin) {
+ this.lastLogin = lastLogin;
}
+
+
+
}