changeset 5933:1b939742629e

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.
author Bernhard Herzog <bh@intevation.de>
date Wed, 08 May 2013 17:56:13 +0200
parents c7951390fd58
children f8d402c6d87a
files gwt-client/src/main/java/org/dive4elements/river/client/server/LoginServlet.java gwt-client/src/main/java/org/dive4elements/river/client/server/auth/Authenticator.java gwt-client/src/main/java/org/dive4elements/river/client/server/auth/plain/Authenticator.java gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Authenticator.java gwt-client/src/main/java/org/dive4elements/river/client/server/filter/GGInAFilter.java
diffstat 5 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }
 }
--- 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;
 
 }
--- 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
     {
--- 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
--- 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);
     }
 
     /**

http://dive4elements.wald.intevation.org