[Minor] code cleanup
This commit is contained in:
parent
901c2c86f2
commit
e3dab98b3f
|
@ -40,7 +40,7 @@ public interface EncryptionHandler {
|
|||
* @return the hash of the string after converting
|
||||
*/
|
||||
public String convertToHash(String string);
|
||||
|
||||
|
||||
/**
|
||||
* Converts a given byte array, e.g. a password to a hash which is defined by the concrete implementation
|
||||
*
|
||||
|
|
|
@ -196,7 +196,7 @@ public class XmlPersistenceHandler implements PersistenceHandler {
|
|||
// validate that role exists
|
||||
if (getRole(roleName) == null) {
|
||||
String msg = "Role {0} does not exist referenced by user {1}";
|
||||
msg = MessageFormat.format(msg, roleName, user.getUsername()); //$NON-NLS-1$
|
||||
msg = MessageFormat.format(msg, roleName, user.getUsername());
|
||||
throw new PrivilegeException(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public enum UserState {
|
|||
* the user has automatically expired through a predefined time
|
||||
*/
|
||||
EXPIRED,
|
||||
|
||||
|
||||
/**
|
||||
* This is the System user state which is special and thus exempted from normal uses
|
||||
*/
|
||||
|
|
|
@ -78,8 +78,8 @@ public final class User {
|
|||
* @param propertyMap
|
||||
* a {@link Map} containing string value pairs of properties for this user
|
||||
*/
|
||||
public User(String userId, String username, String password, String firstname, String lastname, UserState userState,
|
||||
Set<String> roles, Locale locale, Map<String, String> propertyMap) {
|
||||
public User(String userId, String username, String password, String firstname, String lastname,
|
||||
UserState userState, Set<String> roles, Locale locale, Map<String, String> propertyMap) {
|
||||
|
||||
if (StringHelper.isEmpty(userId)) {
|
||||
throw new PrivilegeException("No UserId defined!"); //$NON-NLS-1$
|
||||
|
|
|
@ -185,8 +185,8 @@ public class PrivilegeTest {
|
|||
}
|
||||
|
||||
public void testFailAuthenticationNOk() throws Exception {
|
||||
exception.expect(AccessDeniedException.class);
|
||||
exception.expectMessage("blabla");
|
||||
this.exception.expect(AccessDeniedException.class);
|
||||
this.exception.expectMessage("blabla");
|
||||
try {
|
||||
login(ADMIN, ArraysHelper.copyOf(PASS_BAD));
|
||||
} finally {
|
||||
|
@ -195,8 +195,8 @@ public class PrivilegeTest {
|
|||
}
|
||||
|
||||
public void testFailAuthenticationPWNull() throws Exception {
|
||||
exception.expect(PrivilegeException.class);
|
||||
exception.expectMessage("blabla");
|
||||
this.exception.expect(PrivilegeException.class);
|
||||
this.exception.expectMessage("blabla");
|
||||
try {
|
||||
login(ADMIN, null);
|
||||
} finally {
|
||||
|
@ -250,8 +250,8 @@ public class PrivilegeTest {
|
|||
*/
|
||||
@Test
|
||||
public void testPerformSystemRestrictableFailPrivilege() throws Exception {
|
||||
exception.expect(PrivilegeException.class);
|
||||
exception
|
||||
this.exception.expect(PrivilegeException.class);
|
||||
this.exception
|
||||
.expectMessage("User system_admin does not have Privilege ch.eitchnet.privilege.test.model.TestSystemUserActionDeny");
|
||||
try {
|
||||
// create the action to be performed as a system user
|
||||
|
@ -269,8 +269,9 @@ public class PrivilegeTest {
|
|||
*/
|
||||
@Test
|
||||
public void testPerformSystemRestrictableFailNoAdditionalPrivilege() throws Exception {
|
||||
exception.expect(PrivilegeException.class);
|
||||
exception.expectMessage("User system_admin2 does not have Privilege ch.eitchnet.privilege.test.model.TestRestrictable");
|
||||
this.exception.expect(PrivilegeException.class);
|
||||
this.exception
|
||||
.expectMessage("User system_admin2 does not have Privilege ch.eitchnet.privilege.test.model.TestRestrictable");
|
||||
try {
|
||||
// create the action to be performed as a system user
|
||||
TestSystemUserActionDeny action = new TestSystemUserActionDeny();
|
||||
|
@ -287,8 +288,8 @@ public class PrivilegeTest {
|
|||
*/
|
||||
@Test
|
||||
public void testLoginSystemUser() throws Exception {
|
||||
exception.expect(AccessDeniedException.class);
|
||||
exception.expectMessage("User system_admin is a system user and may not login!");
|
||||
this.exception.expect(AccessDeniedException.class);
|
||||
this.exception.expectMessage("User system_admin is a system user and may not login!");
|
||||
try {
|
||||
login(SYSTEM_USER_ADMIN, SYSTEM_USER_ADMIN.getBytes());
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue