Author: markt
Date: Fri Jul 3 18:49:45 2015
New Revision: 1689056
URL: http://svn.apache.org/r1689056
Log:
Added dummy FORM auth module
Patch by fjodorver
Added:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java
(with props)
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/TomcatAuthConfig.java
Modified:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/TomcatAuthConfig.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/TomcatAuthConfig.java?rev=1689056&r1=1689055&r2=1689056&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/TomcatAuthConfig.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/TomcatAuthConfig.java
Fri Jul 3 18:49:45 2015
@@ -29,6 +29,7 @@ import javax.security.auth.message.confi
import org.apache.catalina.Realm;
import
org.apache.catalina.authenticator.jaspic.provider.modules.BasicAuthModule;
import
org.apache.catalina.authenticator.jaspic.provider.modules.DigestAuthModule;
+import
org.apache.catalina.authenticator.jaspic.provider.modules.FormAuthModule;
import
org.apache.catalina.authenticator.jaspic.provider.modules.TomcatAuthModule;
import org.apache.tomcat.util.descriptor.web.LoginConfig;
import org.apache.tomcat.util.res.StringManager;
@@ -112,6 +113,9 @@ public class TomcatAuthConfig implements
case "DIGEST": {
return new DigestAuthModule(realm);
}
+ case "FORM": {
+ return new FormAuthModule();
+ }
default: {
throw new AuthException(
sm.getString("authenticator.jaspic.unknownAuthType",
authMethod));
Added:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java?rev=1689056&view=auto
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java
(added)
+++
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java
Fri Jul 3 18:49:45 2015
@@ -0,0 +1,88 @@
+/*
+ * 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.authenticator.jaspic.provider.modules;
+
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.message.AuthException;
+import javax.security.auth.message.AuthStatus;
+import javax.security.auth.message.MessageInfo;
+import javax.security.auth.message.MessagePolicy;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+
+/**
+ * This class implements JASPIC FORM-based authentication.
+ */
+public class FormAuthModule extends TomcatAuthModule {
+ private static final Log log = LogFactory.getLog(FormAuthModule.class);
+
+ private Class<?>[] supportedMessageTypes = new Class[] {
HttpServletRequest.class,
+ HttpServletResponse.class };
+
+ private String landingPage;
+
+
+ public FormAuthModule() {
+ }
+
+
+ public FormAuthModule(String landingPage) {
+ this.landingPage = landingPage;
+ }
+
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void initializeModule(MessagePolicy requestPolicy, MessagePolicy
responsePolicy,
+ CallbackHandler handler, Map options) throws AuthException {
+ }
+
+
+ @Override
+ public AuthStatus validateRequest(MessageInfo messageInfo, Subject
clientSubject,
+ Subject serviceSubject) throws AuthException {
+ if (!isMandatory(messageInfo)) {
+ return AuthStatus.SUCCESS;
+ }
+ return AuthStatus.FAILURE;
+
+ }
+
+
+ @Override
+ public AuthStatus secureResponse(MessageInfo messageInfo, Subject
serviceSubject)
+ throws AuthException {
+ return null;
+ }
+
+
+ @Override
+ public void cleanSubject(MessageInfo messageInfo, Subject subject) throws
AuthException {
+ }
+
+
+ @Override
+ public Class<?>[] getSupportedMessageTypes() {
+ return supportedMessageTypes;
+ }
+}
Propchange:
tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/provider/modules/FormAuthModule.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]