You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2020/02/24 16:52:53 UTC

[jspwiki] 11/38: add initialize( Engine, Properties ) to AuthenticationManager

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 05eec06caa81c3c9dbbae84c5976be16674bb753
Author: juanpablo <ju...@apache.org>
AuthorDate: Thu Feb 20 17:51:46 2020 +0100

    add initialize( Engine, Properties ) to AuthenticationManager
---
 .../java/org/apache/wiki/auth/AuthenticationManager.java    | 13 +++++++++++++
 .../org/apache/wiki/auth/DefaultAuthenticationManager.java  |  9 ++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthenticationManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthenticationManager.java
index bd06cd6..b1a01a2 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthenticationManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/AuthenticationManager.java
@@ -19,6 +19,8 @@
 package org.apache.wiki.auth;
 
 import org.apache.wiki.WikiSession;
+import org.apache.wiki.api.core.Engine;
+import org.apache.wiki.api.exceptions.WikiException;
 import org.apache.wiki.auth.authorize.Role;
 import org.apache.wiki.event.WikiEventListener;
 import org.apache.wiki.event.WikiEventManager;
@@ -30,6 +32,7 @@ import javax.security.auth.spi.LoginModule;
 import javax.servlet.http.HttpServletRequest;
 import java.security.Principal;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 
 
@@ -65,6 +68,16 @@ public interface AuthenticationManager {
     String PROP_LOGIN_MODULE = "jspwiki.loginModule.class";
 
     /**
+     * Creates an AuthenticationManager instance for the given WikiEngine and
+     * the specified set of properties. All initialization for the modules is
+     * done here.
+     * @param engine the wiki engine
+     * @param props the properties used to initialize the wiki engine
+     * @throws WikiException if the AuthenticationManager cannot be initialized
+     */
+    void initialize( Engine engine, Properties props ) throws WikiException;
+
+    /**
      * Returns true if this WikiEngine uses container-managed authentication. This method is used primarily for cosmetic purposes in the
      * JSP tier, and performs no meaningful security function per se. Delegates to
      * {@link org.apache.wiki.auth.authorize.WebContainerAuthorizer#isContainerAuthorized()},
diff --git a/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthenticationManager.java b/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthenticationManager.java
index ee5e284..e4566b9 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthenticationManager.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/auth/DefaultAuthenticationManager.java
@@ -103,14 +103,9 @@ public class DefaultAuthenticationManager implements AuthenticationManager {
     private TimedCounterList< String > m_lastLoginAttempts = new TimedCounterList<>();
 
     /**
-     * Creates an AuthenticationManager instance for the given WikiEngine and
-     * the specified set of properties. All initialization for the modules is
-     * done here.
-     * @param engine the wiki engine
-     * @param props the properties used to initialize the wiki engine
-     * @throws WikiException if the AuthenticationManager cannot be initialized
+     * {@inheritDoc}
      */
-    @SuppressWarnings( "unchecked" )
+    @Override
     public void initialize( final Engine engine, final Properties props ) throws WikiException {
         m_engine = engine;
         m_storeIPAddress = TextUtil.getBooleanProperty( props, PROP_STOREIPADDRESS, m_storeIPAddress );