Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java')
-rw-r--r--jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java104
1 files changed, 13 insertions, 91 deletions
diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java b/jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java
index e9f18b59c2..108ca0ad6f 100644
--- a/jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java
+++ b/jetty-security/src/main/java/org/eclipse/jetty/security/HashLoginService.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import org.eclipse.jetty.security.MappedLoginService.KnownUser;
import org.eclipse.jetty.security.PropertyUserStore.UserListener;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.Scanner;
@@ -49,37 +48,15 @@ import org.eclipse.jetty.util.security.Credential;
* <p>
* If DIGEST Authentication is used, the password must be in a recoverable format, either plain text or OBF:.
*/
-public class HashLoginService extends MappedLoginService implements UserListener
+public class HashLoginService extends AbstractLoginService
{
private static final Logger LOG = Log.getLogger(HashLoginService.class);
- private PropertyUserStore _propertyUserStore;
- private String _config;
- private Resource _configResource;
- private Scanner _scanner;
- private boolean hotReload = false; // default is not to reload
+ protected PropertyUserStore _propertyUserStore;
+ protected String _config;
+ protected Resource _configResource;
+ protected boolean hotReload = false; // default is not to reload
-
-
- public class HashKnownUser extends KnownUser
- {
- String[] _roles;
-
- public HashKnownUser(String name, Credential credential)
- {
- super(name, credential);
- }
-
- public void setRoles (String[] roles)
- {
- _roles = roles;
- }
-
- public String[] getRoles()
- {
- return _roles;
- }
- }
/* ------------------------------------------------------------ */
public HashLoginService()
@@ -153,46 +130,11 @@ public class HashLoginService extends MappedLoginService implements UserListener
this.hotReload = enable;
}
- /* ------------------------------------------------------------ */
- /**
- * sets the refresh interval (in seconds)
- * @param sec the refresh interval
- * @deprecated use {@link #setHotReload(boolean)} instead
- */
- @Deprecated
- public void setRefreshInterval(int sec)
- {
- }
-
- /* ------------------------------------------------------------ */
- /**
- * @return refresh interval in seconds for how often the properties file should be checked for changes
- * @deprecated use {@link #isHotReload()} instead
- */
- @Deprecated
- public int getRefreshInterval()
- {
- return (hotReload)?1:0;
- }
-
- /* ------------------------------------------------------------ */
- @Override
- protected UserIdentity loadUser(String username)
- {
- return null;
- }
+
/* ------------------------------------------------------------ */
@Override
- public void loadUsers() throws IOException
- {
- // TODO: Consider refactoring MappedLoginService to not have to override with unused methods
- }
-
-
-
- @Override
- protected String[] loadRoleInfo(KnownUser user)
+ protected String[] loadRoleInfo(UserPrincipal user)
{
UserIdentity id = _propertyUserStore.getUserIdentity(user.getName());
if (id == null)
@@ -210,13 +152,17 @@ public class HashLoginService extends MappedLoginService implements UserListener
return list.toArray(new String[roles.size()]);
}
+
+
+
+ /* ------------------------------------------------------------ */
@Override
- protected KnownUser loadUserInfo(String userName)
+ protected UserPrincipal loadUserInfo(String userName)
{
UserIdentity id = _propertyUserStore.getUserIdentity(userName);
if (id != null)
{
- return (KnownUser)id.getUserPrincipal();
+ return (UserPrincipal)id.getUserPrincipal();
}
return null;
@@ -241,7 +187,6 @@ public class HashLoginService extends MappedLoginService implements UserListener
_propertyUserStore = new PropertyUserStore();
_propertyUserStore.setHotReload(hotReload);
_propertyUserStore.setConfigPath(_config);
- _propertyUserStore.registerUserListener(this);
_propertyUserStore.start();
}
}
@@ -254,28 +199,5 @@ public class HashLoginService extends MappedLoginService implements UserListener
protected void doStop() throws Exception
{
super.doStop();
- if (_scanner != null)
- _scanner.stop();
- _scanner = null;
- }
-
- /* ------------------------------------------------------------ */
- @Override
- public void update(String userName, Credential credential, String[] roleArray)
- {
- if (LOG.isDebugEnabled())
- LOG.debug("update: " + userName + " Roles: " + roleArray.length);
- //TODO need to remove and replace the authenticated user?
- }
-
-
-
- /* ------------------------------------------------------------ */
- @Override
- public void remove(String userName)
- {
- if (LOG.isDebugEnabled())
- LOG.debug("remove: " + userName);
- removeUser(userName);
}
}

Back to the top