com.googlecode.fascinator.authentication.internal
Class InternalAuthentication

java.lang.Object
  extended by com.googlecode.fascinator.authentication.internal.InternalAuthentication
All Implemented Interfaces:
Authentication, Plugin

public class InternalAuthentication
extends Object
implements Authentication

This plugin implements the Fascinator default internal userbase. This plugin mostly a direct port from Fascinator IR code and is a very minimal proof-of-concept implemetation of authentication. Currently it only authenticates from a userbase stored in a local file.

Configuration

Standard configuration table:

Option Description Required Default
internal/path File path in wich the userbase information is stored Yes ${user.home}/.fascinator/users.properties

Examples

  1. Using Internal authentication plugin in The Fascinator
          "authentication": {
             "type": "internal",
             "internal": {
                "path": "${user.home}/.fascinator/users.properties"
             }
           }
     

Wiki Link

None

Author:
Greg Pendlebury

Constructor Summary
InternalAuthentication()
           
 
Method Summary
 void changePassword(String username, String password)
          Change a user's password.
 User createUser(String username, String password)
          Create a user.
 void deleteUser(String username)
          Delete a user.
 String describeUser()
          Describe the metadata the implementing class needs/allows for a user.
 String getId()
           
 String getName()
           
 PluginDescription getPluginDetails()
          Gets a PluginDescription object relating to this plugin.
 User getUser(String username)
          Returns a User object if the implementing class supports user queries without authentication.
 void init(File jsonFile)
           
 void init(String jsonString)
          Initialisation of Internal Authentication plugin
 User logIn(String username, String password)
          Tests the user's username/password validity.
 void logOut(User user)
          Optional logout method if the implementing class wants to do any post-processing.
 User modifyUser(String username, String property, boolean newValue)
           
 User modifyUser(String username, String property, int newValue)
           
 User modifyUser(String username, String property, String newValue)
          Modify one of the user's properties.
 List<User> searchUsers(String search)
          Returns a list of users matching the search.
 void shutdown()
           
 boolean supportsUserManagement()
          Method for testing if the implementing plugin allows the creation, deletion and modification of users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalAuthentication

public InternalAuthentication()
Method Detail

getId

public String getId()
Specified by:
getId in interface Plugin

getName

public String getName()
Specified by:
getName in interface Plugin

getPluginDetails

public PluginDescription getPluginDetails()
Gets a PluginDescription object relating to this plugin.

Specified by:
getPluginDetails in interface Plugin
Returns:
a PluginDescription

init

public void init(String jsonString)
          throws AuthenticationException
Initialisation of Internal Authentication plugin

Specified by:
init in interface Plugin
Throws:
AuthenticationException - if fails to initialise

init

public void init(File jsonFile)
          throws AuthenticationException
Specified by:
init in interface Plugin
Throws:
AuthenticationException

shutdown

public void shutdown()
              throws AuthenticationException
Specified by:
shutdown in interface Plugin
Throws:
AuthenticationException

logIn

public User logIn(String username,
                  String password)
           throws AuthenticationException
Tests the user's username/password validity.

Specified by:
logIn in interface Authentication
Parameters:
username - The username of the user logging in.
password - The password of the user logging in.
Returns:
A user object for the newly logged in user.
Throws:
AuthenticationException - if there was an error logging in.

logOut

public void logOut(User user)
            throws AuthenticationException
Optional logout method if the implementing class wants to do any post-processing.

Specified by:
logOut in interface Authentication
Parameters:
username - The username of the logging out user.
Throws:
AuthenticationException - if there was an error logging out.

supportsUserManagement

public boolean supportsUserManagement()
Method for testing if the implementing plugin allows the creation, deletion and modification of users.

Specified by:
supportsUserManagement in interface Authentication
Returns:
true/false reponse.

describeUser

public String describeUser()
Describe the metadata the implementing class needs/allows for a user. TODO: This is a placeholder of possible later SQUIRE integration.

Specified by:
describeUser in interface Authentication
Returns:
TODO: possibly a JSON string.

createUser

public User createUser(String username,
                       String password)
                throws AuthenticationException
Create a user.

Specified by:
createUser in interface Authentication
Parameters:
username - The username of the new user.
password - The password of the new user.
Returns:
A user object for the newly created in user.
Throws:
AuthenticationException - if there was an error creating the user.

deleteUser

public void deleteUser(String username)
                throws AuthenticationException
Delete a user.

Specified by:
deleteUser in interface Authentication
Parameters:
username - The username of the user to delete.
Throws:
AuthenticationException - if there was an error during deletion.

changePassword

public void changePassword(String username,
                           String password)
                    throws AuthenticationException
Change a user's password.

Specified by:
changePassword in interface Authentication
Parameters:
username - The user changing their password.
password - The new password for the user.
Throws:
AuthenticationException - if there was an error changing the password.

modifyUser

public User modifyUser(String username,
                       String property,
                       String newValue)
                throws AuthenticationException
Modify one of the user's properties. Available properties should match up with the return value of describeUser().

Specified by:
modifyUser in interface Authentication
Parameters:
username - The user being modified.
property - The user property being modified.
newValue - The new value to be assigned to the property.
Returns:
An updated user object for the modifed user.
Throws:
AuthenticationException - if there was an error during modification.

modifyUser

public User modifyUser(String username,
                       String property,
                       int newValue)
                throws AuthenticationException
Specified by:
modifyUser in interface Authentication
Throws:
AuthenticationException

modifyUser

public User modifyUser(String username,
                       String property,
                       boolean newValue)
                throws AuthenticationException
Specified by:
modifyUser in interface Authentication
Throws:
AuthenticationException

getUser

public User getUser(String username)
             throws AuthenticationException
Returns a User object if the implementing class supports user queries without authentication.

Specified by:
getUser in interface Authentication
Parameters:
username - The username of the user required.
Returns:
An user object of the requested user.
Throws:
AuthenticationException - if there was an error retrieving the object.

searchUsers

public List<User> searchUsers(String search)
                       throws AuthenticationException
Returns a list of users matching the search.

Specified by:
searchUsers in interface Authentication
Parameters:
search - The search string to execute.
Returns:
A list of usernames (String) that match the search.
Throws:
AuthenticationException - if there was an error searching.


Copyright © 2009-2014. All Rights Reserved.