[Dive4elements-commits] [PATCH 01 of 21] Pass LoginServlet's ServletContext to the Authenticators

Wald Commits scm-commit at wald.intevation.org
Wed May 8 18:08:11 CEST 2013


# HG changeset patch
# User Bernhard Herzog <bh at intevation.de>
# Date 1368028573 -7200
# Node ID 1b939742629e1d20e069d540f116a0b95c610f4f
# Parent  c7951390fd5862ba12e9a96587a1c080c859c707
Pass LoginServlet's ServletContext to the Authenticators.
When implementing SAML validation we need a way to configure a trusted
key, and passing the ServletContext seems to be about the simplest way
to do this.

diff -r c7951390fd58 -r 1b939742629e gwt-client/src/main/java/org/dive4elements/river/client/server/LoginServlet.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/LoginServlet.java	Wed May 08 17:52:54 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/LoginServlet.java	Wed May 08 17:56:13 2013 +0200
@@ -123,6 +123,6 @@
         Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE);
         String auth = sc.getInitParameter("authentication");
         return AuthenticationFactory.getInstance(auth).auth(username, password,
-                encoding, features);
+                encoding, features, sc);
     }
 }
diff -r c7951390fd58 -r 1b939742629e gwt-client/src/main/java/org/dive4elements/river/client/server/auth/Authenticator.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/Authenticator.java	Wed May 08 17:52:54 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/Authenticator.java	Wed May 08 17:56:13 2013 +0200
@@ -10,11 +10,16 @@
 
 import java.io.IOException;
 
+import javax.servlet.ServletContext;
+
 import org.dive4elements.river.client.server.features.Features;
 
+
 public interface Authenticator {
 
-    public Authentication auth(String username, String password, String encoding, Features features)
+    public Authentication auth(String username, String password,
+                               String encoding, Features features,
+                               ServletContext context)
         throws AuthenticationException, IOException;
 
 }
diff -r c7951390fd58 -r 1b939742629e gwt-client/src/main/java/org/dive4elements/river/client/server/auth/plain/Authenticator.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/plain/Authenticator.java	Wed May 08 17:52:54 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/plain/Authenticator.java	Wed May 08 17:56:13 2013 +0200
@@ -20,6 +20,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.servlet.ServletContext;
+
 import org.apache.log4j.Logger;
 
 import org.dive4elements.river.client.server.features.Features;
@@ -88,7 +90,8 @@
         String username,
         String password,
         String encoding,
-        Features features
+        Features features,
+        ServletContext context
     )
     throws AuthenticationException, IOException
     {
diff -r c7951390fd58 -r 1b939742629e gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java	Wed May 08 17:52:54 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java	Wed May 08 17:56:13 2013 +0200
@@ -10,6 +10,7 @@
 
 import java.io.IOException;
 import java.security.GeneralSecurityException;
+import javax.servlet.ServletContext;
 
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
@@ -32,7 +33,8 @@
         String username,
         String password,
         String encoding,
-        Features features
+        Features features,
+        ServletContext context
     ) throws
         AuthenticationException,
         IOException
diff -r c7951390fd58 -r 1b939742629e gwt-client/src/main/java/org/dive4elements/river/client/server/filter/GGInAFilter.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/filter/GGInAFilter.java	Wed May 08 17:52:54 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/filter/GGInAFilter.java	Wed May 08 17:56:13 2013 +0200
@@ -192,7 +192,7 @@
         throws AuthenticationException, IOException {
         Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE);
         return AuthenticationFactory.getInstance(this.authmethod).auth(
-                user.getName(), user.getPassword(), encoding, features);
+                user.getName(), user.getPassword(), encoding, features, sc);
     }
 
     /**


More information about the Dive4elements-commits mailing list