diff options
author | Olivier Lamy <olamy@apache.org> | 2012-11-22 21:57:18 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-11-22 21:57:18 +0000 |
commit | a8544147e109cc3c25754fdb51c86a7165a2f0a1 (patch) | |
tree | d7734e582c726acdbe94873c187eccde0a9324a0 /archiva-modules/archiva-web/archiva-security | |
parent | 9eafbcc85a8dc2873fa8c12d37ff56ff0c12381f (diff) | |
download | archiva-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/archiva-security')
2 files changed, 2 insertions, 66 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 ) |