[jboss-cvs] JBossAS SVN: r59488 - projects/security/security-spi/trunk/src/main/org/jboss/security.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 10 12:23:48 EST 2007


Author: anil.saldhana at jboss.com
Date: 2007-01-10 12:23:47 -0500 (Wed, 10 Jan 2007)
New Revision: 59488

Added:
   projects/security/security-spi/trunk/src/main/org/jboss/security/SecurityContextUtil.java
Removed:
   projects/security/security-spi/trunk/src/main/org/jboss/security/SecurityConstants.java
Log:
add util

Deleted: projects/security/security-spi/trunk/src/main/org/jboss/security/SecurityConstants.java
===================================================================
--- projects/security/security-spi/trunk/src/main/org/jboss/security/SecurityConstants.java	2007-01-10 17:23:08 UTC (rev 59487)
+++ projects/security/security-spi/trunk/src/main/org/jboss/security/SecurityConstants.java	2007-01-10 17:23:47 UTC (rev 59488)
@@ -1,104 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.security;
-
-//$Id$
-
-/**
- *  Defines Constants for usage in the Security Layer
- *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- *  @since  Dec 30, 2005 
- *  @version $Revision$
- */
-public interface SecurityConstants
-{
-   /**
-    * Default Application Policy 
-    */
-   String DEFAULT_APPLICATION_POLICY = "other";
-   
-   /**
-    * Default JAAS based Security Domain Context
-    */
-   String JAAS_CONTEXT_ROOT = "java:/jaas";
-   
-   /**
-    * Default JASPI based Security Domain Context
-    */
-   String JASPI_CONTEXT_ROOT = "java:/jbsx";
-   
-   /**
-    * The String option name used to pass in the security-domain 
-    * name the LoginModule was configured in.
-    */
-   String SECURITY_DOMAIN_OPTION = "jboss.security.security_domain";
-
-   /**
-    * Default Authorization Manager context
-    */
-   String AUTHORIZATION_PATH = "java:/authorizationMgr";
-   
-   /**
-    * Default ServerAuthModule that delegates to a Login Module Stack
-    */
-   String JASPI_DELEGATING_MODULE = "org.jboss.security.auth.container.modules.DelegatingServerAuthModule";
-   
-   /**
-    * Default JASPI based secutity manager
-    */
-   String JASPI_AUTHENTICATION_MANAGER = "org.jboss.security.plugins.JASPISecurityManager";
-   
-   /**
-    * Default AuthorizationManager implementation, the AuthorizationManager service uses
-    * 
-    */
-   String DEFAULT_AUTHORIZATION_CLASS = "org.jboss.security.plugins.JBossAuthorizationManager";
-   
-   /**
-    * Message Layers
-    */
-   String SERVLET_LAYER = "HttpServlet";
-   
-   String CONTEXT_ID = "jboss.contextid";
-   
-   /**
-    * Application Policy driving the web authorization layer
-    */
-   String DEFAULT_WEB_APPLICATION_POLICY = "jboss-web-policy";
-   
-   /**
-    * Application Policy driving the ejb authorization layer
-    */
-   String DEFAULT_EJB_APPLICATION_POLICY = "jboss-ejb-policy";
-   
-   
-   /** Policy Context Constants **/
-   String SUBJECT_CONTEXT_KEY = "javax.security.auth.Subject.container";
-   String WEB_REQUEST_KEY = "javax.servlet.http.HttpServletRequest";
-   
-   String ROLES_IDENTIFIER = "Roles";
-   String PRINCIPAL_IDENTIFIER = "Principal";
-   String PRINCIPALS_SET_IDENTIFIER = "PrincipalsSet"; 
-   String DEPLOYMENT_PRINCIPAL_ROLES_MAP = "deploymentPrincipalRolesMap";
-   
-   String SECURITY_CONTEXT = "SecurityContext";
-}

Added: projects/security/security-spi/trunk/src/main/org/jboss/security/SecurityContextUtil.java
===================================================================
--- projects/security/security-spi/trunk/src/main/org/jboss/security/SecurityContextUtil.java	2007-01-10 17:23:08 UTC (rev 59487)
+++ projects/security/security-spi/trunk/src/main/org/jboss/security/SecurityContextUtil.java	2007-01-10 17:23:47 UTC (rev 59488)
@@ -0,0 +1,69 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security;
+
+import java.security.Principal;
+
+//$Id$
+
+/**
+ *  General Utility methods for dealing with the SecurityContext
+ *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ *  @since  Jan 5, 2007 
+ *  @version $Revision$
+ */
+public abstract class SecurityContextUtil
+{
+   /**
+    * Get the username from the subject info
+    * @param si subject info
+    * @return username
+    */
+   public abstract String getUserName(SubjectInfo si);
+   
+   /**
+    * Get the user principal from the subject info
+    * @param si
+    * @return user principal
+    */
+   public abstract Principal getUserPrincipal(SubjectInfo si); 
+   
+   /**
+    * Set an object on the Security Context
+    * The context implementation may place the object in its internal
+    * data structures (like the Data Map)
+    * @param <T> Generic Type
+    * @param sc Security Context Object
+    * @param key Key representing the object being set
+    * @param obj
+    */
+   public abstract <T> void set(SecurityContext sc, String key, T obj);
+   
+   /**
+    * Return an object from the Security Context
+    * @param <T>
+    * @param sc Security Context Object
+    * @param key key identifies the type of object we are requesting
+    * @return
+    */
+   public abstract <T> T get(SecurityContext sc, String key);
+}




More information about the jboss-cvs-commits mailing list