Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A2E6717D8A for ; Sat, 30 May 2015 14:47:30 +0000 (UTC) Received: (qmail 57913 invoked by uid 500); 30 May 2015 14:47:30 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 57869 invoked by uid 500); 30 May 2015 14:47:30 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 57860 invoked by uid 99); 30 May 2015 14:47:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 30 May 2015 14:47:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 439D0E03FA; Sat, 30 May 2015 14:47:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: smckinney@apache.org To: commits@directory.apache.org Message-Id: <82e16af0247b42d4b6855f76eae25d47@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: directory-fortress-realm git commit: FC-105 - break package cycle Date: Sat, 30 May 2015 14:47:30 +0000 (UTC) Repository: directory-fortress-realm Updated Branches: refs/heads/master 1d819c578 -> 0543fd785 FC-105 - break package cycle Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/repo Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/commit/0543fd78 Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/tree/0543fd78 Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/diff/0543fd78 Branch: refs/heads/master Commit: 0543fd785f3f59b542a333d0049367316342c58c Parents: 1d819c5 Author: Shawn McKinney Authored: Sat May 30 09:47:28 2015 -0500 Committer: Shawn McKinney Committed: Sat May 30 09:47:28 2015 -0500 ---------------------------------------------------------------------- .../directory/fortress/realm/J2eePolicyMgr.java | 3 +- .../fortress/realm/J2eePolicyMgrImpl.java | 1 - .../directory/fortress/realm/TcPrincipal.java | 162 +++++++++++++++++++ .../realm/tomcat/TC7AccessMgrFascade.java | 2 +- .../fortress/realm/tomcat/TcAccessMgrImpl.java | 1 + .../fortress/realm/tomcat/TcPrincipal.java | 162 ------------------- 6 files changed, 165 insertions(+), 166 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/0543fd78/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgr.java ---------------------------------------------------------------------- diff --git a/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgr.java b/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgr.java index 65b6ea0..a460f38 100644 --- a/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgr.java +++ b/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgr.java @@ -26,7 +26,6 @@ import org.apache.directory.fortress.core.rbac.User; import org.apache.directory.fortress.core.rbac.Role; import org.apache.directory.fortress.core.SecurityException; import org.apache.directory.fortress.core.rbac.Session; -import org.apache.directory.fortress.realm.tomcat.TcPrincipal; /** * This interface is for components that use Websphere and Tomcat Container SPI's to provide @@ -226,7 +225,7 @@ public interface J2eePolicyMgr /** * Determine if given Role is contained within User's Tomcat Principal object. This method does not need to hit - * the ldap server as the User's activated Roles are loaded into {@link org.apache.directory.fortress.realm.tomcat.TcPrincipal#setContext(java.util.HashMap)} + * the ldap server as the User's activated Roles are loaded into {@link TcPrincipal#setContext(java.util.HashMap)} * * @param principal Contains User's Tomcat RBAC Session data that includes activated Roles. * @param roleName Maps to {@link org.apache.directory.fortress.core.rbac.Role#name}. http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/0543fd78/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java ---------------------------------------------------------------------- diff --git a/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java b/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java index 03b10c4..0190d01 100644 --- a/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java +++ b/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java @@ -40,7 +40,6 @@ import org.apache.directory.fortress.core.GlobalErrIds; import org.apache.directory.fortress.core.rbac.User; import org.apache.directory.fortress.core.rbac.Role; import org.apache.directory.fortress.core.rbac.Session; -import org.apache.directory.fortress.realm.tomcat.TcPrincipal; import org.apache.directory.fortress.core.util.attr.VUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/0543fd78/impl/src/main/java/org/apache/directory/fortress/realm/TcPrincipal.java ---------------------------------------------------------------------- diff --git a/impl/src/main/java/org/apache/directory/fortress/realm/TcPrincipal.java b/impl/src/main/java/org/apache/directory/fortress/realm/TcPrincipal.java new file mode 100644 index 0000000..3f484b8 --- /dev/null +++ b/impl/src/main/java/org/apache/directory/fortress/realm/TcPrincipal.java @@ -0,0 +1,162 @@ +/* + * 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. + * + */ +package org.apache.directory.fortress.realm; + +import java.io.Serializable; +import java.security.Principal; +import java.util.HashMap; + +/** + * Contains the Fortress RBAC session that has been created on behalf of an end user who has + * signed onto Tomcat system. The session contains the User's active roles and other security attributes. + * + * @author Apache Directory Project + */ +public class TcPrincipal implements Principal, Serializable +{ + /** Default serialVersionUID */ + private static final long serialVersionUID = 1L; + + /** The key when we store a serialiazed version of a Session into the context */ + public static final String SERIALIZED = "SERIALIZED"; + + /** The context storing the session */ + private HashMap context; + + /** The userId */ + private String name; + + + /** + * Constructor for the TcPrincipal object. Accepts a HashMap which + * contains the Fortress session. + * + * @param name contains the userId of User who signed onto Tomcat. + * @param context Instantiated HashMap that contains the User's Fortress session data. + */ + public TcPrincipal( String name, HashMap context ) + { + if ( ( context == null ) || ( name == null ) ) + { + throw new IllegalArgumentException( TcPrincipal.class.getName() + " Null Map passed to constructor" ); + } + + this.context = context; + this.name = name; + } + + + /** + * Return the HashMap to the caller. This HashMap contains the User's Fortress session data. + * + * @return HashMap reference to security session data. + */ + public final HashMap getContext() + { + return context; + } + + + /** + * Return the userId of the end User who has signed onto Tomcat and is represented by this principal object. + * + * @return Contains the end userId. + */ + public final String getName() + { + return name; + } + + + /** + * Set a new HashMap reference into this Principal object. + * + * @param context HashMap reference to security session data. + */ + public final void setContext( HashMap context ) + { + this.context = context; + } + + + /** + * This method returns a string containing the serialized instance of this object. + * + * @return Return this object in serialized format. + */ + public final String toString() + { + String ser = "userId=" + name; + HashMap context = getContext(); + + if ( context != null ) + { + ser = (String)context.get( SERIALIZED ); + } + + return ser; + } + + + /** + * Determine if the caller supplied a reference to a security Principal that is equal to the current value. + * + * @param o Contains reference to the Principal. + * @return true if the userId on both Principal objects is equal, false otherwise. + */ + public final boolean equals( Object o ) + { + if ( o == null ) + { + return false; + } + + if ( this == o ) + { + return true; + } + + if ( !( o instanceof TcPrincipal ) ) + { + return false; + } + + TcPrincipal that = ( TcPrincipal ) o; + + if ( this.getName().equals( that.getName() ) ) + { + return true; + } + + return false; + } + + + /** + * Compute the hashcode for the current userId asserted into this Principal object. + * + * @return Description of the Return Value + */ + public final int hashCode() + { + return name.hashCode(); + } +} + http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/0543fd78/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TC7AccessMgrFascade.java ---------------------------------------------------------------------- diff --git a/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TC7AccessMgrFascade.java b/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TC7AccessMgrFascade.java index 72ed031..d820dd9 100644 --- a/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TC7AccessMgrFascade.java +++ b/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TC7AccessMgrFascade.java @@ -79,7 +79,7 @@ public class TC7AccessMgrFascade extends RealmBase /** * Determine if given Role is contained within User's Tomcat Principal object. This method does not need to hit - * the ldap server as the User's activated Roles are loaded into {@link org.apache.directory.fortress.realm.tomcat.TcPrincipal#setContext(java.util.HashMap)} + * the ldap server as the User's activated Roles are loaded into {@link org.apache.directory.fortress.realm.TcPrincipal#setContext(java.util.HashMap)} * * @param principal Contains User's Tomcat RBAC Session data that includes activated Roles. * @param role Maps to {@code org.apache.directory.fortress.core.rbac.Role#name}. http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/0543fd78/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java ---------------------------------------------------------------------- diff --git a/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java b/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java index bdfa6f5..e2e1f6d 100644 --- a/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java +++ b/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java @@ -23,6 +23,7 @@ import org.apache.directory.fortress.core.SecurityException; import org.apache.directory.fortress.core.util.attr.VUtil; import org.apache.directory.fortress.realm.J2eePolicyMgr; import org.apache.directory.fortress.realm.J2eePolicyMgrFactory; +import org.apache.directory.fortress.realm.TcPrincipal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/0543fd78/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcPrincipal.java ---------------------------------------------------------------------- diff --git a/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcPrincipal.java b/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcPrincipal.java deleted file mode 100644 index 6c392ce..0000000 --- a/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcPrincipal.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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. - * - */ -package org.apache.directory.fortress.realm.tomcat; - -import java.io.Serializable; -import java.security.Principal; -import java.util.HashMap; - -/** - * Contains the Fortress RBAC session that has been created on behalf of an end user who has - * signed onto Tomcat system. The session contains the User's active roles and other security attributes. - * - * @author Apache Directory Project - */ -public class TcPrincipal implements Principal, Serializable -{ - /** Default serialVersionUID */ - private static final long serialVersionUID = 1L; - - /** The key when we store a serialiazed version of a Session into the context */ - public static final String SERIALIZED = "SERIALIZED"; - - /** The context storing the session */ - private HashMap context; - - /** The userId */ - private String name; - - - /** - * Constructor for the TcPrincipal object. Accepts a HashMap which - * contains the Fortress session. - * - * @param name contains the userId of User who signed onto Tomcat. - * @param context Instantiated HashMap that contains the User's Fortress session data. - */ - public TcPrincipal( String name, HashMap context ) - { - if ( ( context == null ) || ( name == null ) ) - { - throw new IllegalArgumentException( TcPrincipal.class.getName() + " Null Map passed to constructor" ); - } - - this.context = context; - this.name = name; - } - - - /** - * Return the HashMap to the caller. This HashMap contains the User's Fortress session data. - * - * @return HashMap reference to security session data. - */ - public final HashMap getContext() - { - return context; - } - - - /** - * Return the userId of the end User who has signed onto Tomcat and is represented by this principal object. - * - * @return Contains the end userId. - */ - public final String getName() - { - return name; - } - - - /** - * Set a new HashMap reference into this Principal object. - * - * @param context HashMap reference to security session data. - */ - public final void setContext( HashMap context ) - { - this.context = context; - } - - - /** - * This method returns a string containing the serialized instance of this object. - * - * @return Return this object in serialized format. - */ - public final String toString() - { - String ser = "userId=" + name; - HashMap context = getContext(); - - if ( context != null ) - { - ser = (String)context.get( SERIALIZED ); - } - - return ser; - } - - - /** - * Determine if the caller supplied a reference to a security Principal that is equal to the current value. - * - * @param o Contains reference to the Principal. - * @return true if the userId on both Principal objects is equal, false otherwise. - */ - public final boolean equals( Object o ) - { - if ( o == null ) - { - return false; - } - - if ( this == o ) - { - return true; - } - - if ( !( o instanceof TcPrincipal ) ) - { - return false; - } - - TcPrincipal that = ( TcPrincipal ) o; - - if ( this.getName().equals( that.getName() ) ) - { - return true; - } - - return false; - } - - - /** - * Compute the hashcode for the current userId asserted into this Principal object. - * - * @return Description of the Return Value - */ - public final int hashCode() - { - return name.hashCode(); - } -} -