tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1241027 - in /tomcat/trunk/java/org/apache/catalina: TomcatPrincipal.java connector/Request.java realm/GenericPrincipal.java session/StandardSession.java
Date Mon, 06 Feb 2012 14:48:19 GMT
Author: markt
Date: Mon Feb  6 14:48:18 2012
New Revision: 1241027

URL: http://svn.apache.org/viewvc?rev=1241027&view=rev
Log:
Remove two more package dependencies

Added:
    tomcat/trunk/java/org/apache/catalina/TomcatPrincipal.java
Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Request.java
    tomcat/trunk/java/org/apache/catalina/realm/GenericPrincipal.java
    tomcat/trunk/java/org/apache/catalina/session/StandardSession.java

Added: tomcat/trunk/java/org/apache/catalina/TomcatPrincipal.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/TomcatPrincipal.java?rev=1241027&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/TomcatPrincipal.java (added)
+++ tomcat/trunk/java/org/apache/catalina/TomcatPrincipal.java Mon Feb  6 14:48:18 2012
@@ -0,0 +1,50 @@
+/*
+ * 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.catalina;
+
+import java.security.Principal;
+
+import org.ietf.jgss.GSSCredential;
+
+/**
+ * Defines additional methods implemented by {@link Principal}s created by
+ * Tomcat's standard {@link Realm} implementations.
+ */
+public interface TomcatPrincipal extends Principal {
+
+    /**
+     * The authenticated Principal to be exposed to applications.
+     */
+    Principal getUserPrincipal();
+
+    /**
+     * The user's delegated credentials.
+     */
+    GSSCredential getGssCredential();
+
+    /**
+     * Calls logout, if necessary, on any associated JAASLoginContext. May in
+     * the future be extended to cover other logout requirements.
+     *
+     * @throws Exception If something goes wrong with the logout. Uses Exception
+     *                   to allow for future expansion of this method to cover
+     *                   other logout mechanisms that might throw a different
+     *                   exception to LoginContext
+     *
+     */
+    void logout() throws Exception;
+}

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1241027&r1=1241026&r2=1241027&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Mon Feb  6 14:48:18 2012
@@ -66,12 +66,12 @@ import org.apache.catalina.Host;
 import org.apache.catalina.Manager;
 import org.apache.catalina.Realm;
 import org.apache.catalina.Session;
+import org.apache.catalina.TomcatPrincipal;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.core.ApplicationPart;
 import org.apache.catalina.core.ApplicationSessionCookieConfig;
 import org.apache.catalina.core.AsyncContextImpl;
 import org.apache.catalina.deploy.LoginConfig;
-import org.apache.catalina.realm.GenericPrincipal;
 import org.apache.catalina.util.ParameterMap;
 import org.apache.catalina.util.StringParser;
 import org.apache.coyote.ActionCode;
@@ -2263,8 +2263,8 @@ public class Request
      */
     @Override
     public Principal getUserPrincipal() {
-        if (userPrincipal instanceof GenericPrincipal) {
-            return ((GenericPrincipal) userPrincipal).getUserPrincipal();
+        if (userPrincipal instanceof TomcatPrincipal) {
+            return ((TomcatPrincipal) userPrincipal).getUserPrincipal();
         }
 
         return userPrincipal;
@@ -3172,8 +3172,8 @@ public class Request
                 new SpecialAttributeAdapter() {
                     @Override
                     public Object get(Request request, String name) {
-                        if (request.userPrincipal instanceof GenericPrincipal) {
-                            return ((GenericPrincipal) request.userPrincipal)
+                        if (request.userPrincipal instanceof TomcatPrincipal) {
+                            return ((TomcatPrincipal) request.userPrincipal)
                                     .getGssCredential();
                         }
                         return null;

Modified: tomcat/trunk/java/org/apache/catalina/realm/GenericPrincipal.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/GenericPrincipal.java?rev=1241027&r1=1241026&r2=1241027&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/GenericPrincipal.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/GenericPrincipal.java Mon Feb  6 14:48:18
2012
@@ -25,6 +25,7 @@ import java.util.List;
 
 import javax.security.auth.login.LoginContext;
 
+import org.apache.catalina.TomcatPrincipal;
 import org.ietf.jgss.GSSCredential;
 
 
@@ -36,7 +37,7 @@ import org.ietf.jgss.GSSCredential;
  * @version $Id$
  */
 
-public class GenericPrincipal implements Principal {
+public class GenericPrincipal implements TomcatPrincipal {
 
 
     // ----------------------------------------------------------- Constructors
@@ -175,6 +176,7 @@ public class GenericPrincipal implements
      */
     protected Principal userPrincipal = null;
 
+    @Override
     public Principal getUserPrincipal() {
         if (userPrincipal != null) {
             return userPrincipal;
@@ -251,6 +253,7 @@ public class GenericPrincipal implements
      *                   exception to LoginContext
      *
      */
+    @Override
     public void logout() throws Exception {
         if (loginContext != null) {
             loginContext.logout();

Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSession.java?rev=1241027&r1=1241026&r2=1241027&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/StandardSession.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardSession.java Mon Feb  6 14:48:18
2012
@@ -52,7 +52,7 @@ import org.apache.catalina.Manager;
 import org.apache.catalina.Session;
 import org.apache.catalina.SessionEvent;
 import org.apache.catalina.SessionListener;
-import org.apache.catalina.realm.GenericPrincipal;
+import org.apache.catalina.TomcatPrincipal;
 import org.apache.catalina.security.SecurityUtil;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
@@ -825,8 +825,8 @@ public class StandardSession implements 
             }
 
             // Call the logout method
-            if (principal instanceof GenericPrincipal) {
-                GenericPrincipal gp = (GenericPrincipal) principal;
+            if (principal instanceof TomcatPrincipal) {
+                TomcatPrincipal gp = (TomcatPrincipal) principal;
                 try {
                     gp.logout();
                 } catch (Exception e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message