summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-11-22 21:57:18 +0000
committerOlivier Lamy <olamy@apache.org>2012-11-22 21:57:18 +0000
commita8544147e109cc3c25754fdb51c86a7165a2f0a1 (patch)
treed7734e582c726acdbe94873c187eccde0a9324a0 /archiva-modules/archiva-web
parent9eafbcc85a8dc2873fa8c12d37ff56ff0c12381f (diff)
downloadarchiva-a8544147e109cc3c25754fdb51c86a7165a2f0a1.tar.gz
archiva-a8544147e109cc3c25754fdb51c86a7165a2f0a1.zip
remove this ugly Object getPrincipal method
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1412689 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaXworkUser.java64
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java18
3 files changed, 7 insertions, 79 deletions
diff --git a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaXworkUser.java b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaXworkUser.java
deleted file mode 100644
index c0850f12e..000000000
--- a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaXworkUser.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.apache.archiva.security;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.Map;
-
-import org.apache.archiva.redback.users.UserManager;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.apache.archiva.redback.system.SecuritySystemConstants;
-import org.apache.archiva.redback.users.User;
-
-/**
- * ArchivaXworkUser
- *
- *
- */
-public final class ArchivaXworkUser
-{
- private ArchivaXworkUser()
- {
- // no touchy
- }
-
- public static String getActivePrincipal( Map<String, ?> sessionMap )
- {
- if ( sessionMap == null )
- {
- return UserManager.GUEST_USERNAME;
- }
-
- SecuritySession securitySession =
- (SecuritySession) sessionMap.get( SecuritySystemConstants.SECURITY_SESSION_KEY );
-
- if ( securitySession == null )
- {
- return UserManager.GUEST_USERNAME;
- }
-
- User user = securitySession.getUser();
- if ( user == null )
- {
- return UserManager.GUEST_USERNAME;
- }
-
- return (String) user.getPrincipal();
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
index 08ae19a35..5163eaf61 100644
--- a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
@@ -139,11 +139,11 @@ public abstract class AbstractSecurityTest
// Setup Admin User.
User adminUser = createUser( USER_ADMIN, "Admin User" );
- roleManager.assignRole( ArchivaRoleConstants.TEMPLATE_SYSTEM_ADMIN, adminUser.getPrincipal().toString() );
+ roleManager.assignRole( ArchivaRoleConstants.TEMPLATE_SYSTEM_ADMIN, adminUser.getUsername() );
// Setup Guest User.
User guestUser = createUser( USER_GUEST, "Guest User" );
- roleManager.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, guestUser.getPrincipal().toString() );
+ roleManager.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, guestUser.getUsername() );
}
protected void restoreGuestInitialValues( String userId )
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
index 63290698e..f49979acb 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
@@ -160,24 +160,20 @@ public class SecuritySystemStub
{
return new User()
{
- public Object getPrincipal()
- {
- return "guest";
- }
public String getUsername()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return "guest";
}
public void setUsername( String name )
{
- //To change body of implemented methods use File | Settings | File Templates.
+
}
public String getFullName()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return null;
}
public void setFullName( String name )
@@ -349,19 +345,15 @@ public class SecuritySystemStub
{
return new User()
{
- public Object getPrincipal()
- {
- return "guest";
- }
public String getUsername()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return "guest";
}
public void setUsername( String name )
{
- //To change body of implemented methods use File | Settings | File Templates.
+
}
public String getFullName()