diff options
5 files changed, 9 insertions, 89 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java index 42eda10fe..3286e22bb 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java @@ -63,7 +63,7 @@ public abstract class AbstractRepositoryAdmin { User user = auditInformation == null ? null : auditInformation.getUser(); AuditEvent event = - new AuditEvent( repositoryId, user == null ? "null" : (String) user.getPrincipal(), resource, action ); + new AuditEvent( repositoryId, user == null ? "null" : user.getUsername(), resource, action ); event.setRemoteIP( auditInformation == null ? "null" : auditInformation.getRemoteAddr() ); for ( AuditListener listener : getAuditListeners() ) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java index 767d10c9e..f90c663bf 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java @@ -96,15 +96,7 @@ public abstract class AbstractRepositoryAdminTest protected User getFakeUser() { - SimpleUser user = new SimpleUser() - { - @Override - public Object getPrincipal() - { - return "root"; - } - - }; + SimpleUser user = new SimpleUser(); user.setUsername( "root" ); user.setFullName( "The top user" ); 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() |