com.googlecode.fascinator.roles.ldap
Class LDAPRoles

java.lang.Object
  extended by com.googlecode.fascinator.roles.ldap.LDAPRoles
All Implemented Interfaces:
com.googlecode.fascinator.api.Plugin, com.googlecode.fascinator.api.roles.Roles

public class LDAPRoles
extends Object
implements com.googlecode.fascinator.api.roles.Roles

This plugin implements ldap roles.

Configuration

Standard configuration table:

Option Description Required Default
ldap/baseURL URL of the LDAP server Yes ldap://ldap.uq.edu.au:389
ldap/baseDN The base Distinguished Name to search under Yes ou=people,o=The University of Queensland,c=AU
ldap/idAttribute The name of the attribute for which the username will be searched under Yes uid
ldap/filterPrefix The prefix for the LDAP search filter No (empty string)
ldap/filterSuffix The suffix for the LDAP search filter No (empty string)
ldap/ldapRoleAttribute The name of the LDAP attribute that contains the role values No objectClass
ldap/ldapRoleMap This value maps role attribute values from LDAP to the fascinator roles. If the role attribute value does not exist in the mapping, the user will not have any roles. Yes (empty list)

Examples

  1. Using ldap role plugin in The Fascinator
          "roles": {
              "type": "ldap",
              "ldap": {
                    "baseURL": "ldap://ldap.uq.edu.au:389",
                    "baseDN": "ou=people,o=The University of Queensland,c=AU",
                    "idAttribute": "uid",
                    "filterPrefix": "uniquemember=",
                    "filterSuffix": ",ou=people,dc=adelaide,dc=edu,dc=au",
                    "ldapRoleAttribute": "cn",
                    "ldapRoleMap": [
                          {
                                "ldapRoleAttrValue": "TFREG"
                                "roles": ["registered"]
                          },
                          {
                                "ldapRoleAttrValue": "TFADM"
                                "roles": ["admin"]
                          }
                    ]
                }
          }
     

Wiki Link

None

Author:
Greg Pendlebury and, Richard Hammond and, Andrew Brazzatti and, Mike Jones

Constructor Summary
LDAPRoles()
           
 
Method Summary
 void createRole(String rolename)
          Create a role.
 void deleteRole(String rolename)
          Delete a role.
 String getId()
           
 String getName()
           
 com.googlecode.fascinator.api.PluginDescription getPluginDetails()
          Gets a PluginDescription object relating to this plugin.
 String[] getRoles(String username)
          Find and return all roles this user has.
 String[] getUsersInRole(String role)
          Returns a list of users who have a particular role.
 void init(File jsonFile)
           
 void init(String jsonString)
           
 void removeRole(String username, String oldrole)
          Remove a role from a user.
 void renameRole(String oldrole, String newrole)
          Rename a role.
 String[] searchRoles(String search)
          Returns a list of roles matching the search.
 void setConfig(com.googlecode.fascinator.common.JsonSimpleConfig config)
           
 void setRole(String username, String newrole)
          Assign a role to a user.
 void shutdown()
           
 boolean supportsRoleManagement()
          Method for testing if the implementing plugin allows the creation, deletion and modification of roles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPRoles

public LDAPRoles()
Method Detail

getId

public String getId()
Specified by:
getId in interface com.googlecode.fascinator.api.Plugin

getName

public String getName()
Specified by:
getName in interface com.googlecode.fascinator.api.Plugin

getPluginDetails

public com.googlecode.fascinator.api.PluginDescription getPluginDetails()
Gets a PluginDescription object relating to this plugin.

Specified by:
getPluginDetails in interface com.googlecode.fascinator.api.Plugin
Returns:
a PluginDescription

init

public void init(String jsonString)
          throws com.googlecode.fascinator.api.roles.RolesException
Specified by:
init in interface com.googlecode.fascinator.api.Plugin
Throws:
com.googlecode.fascinator.api.roles.RolesException

init

public void init(File jsonFile)
          throws com.googlecode.fascinator.api.roles.RolesException
Specified by:
init in interface com.googlecode.fascinator.api.Plugin
Throws:
com.googlecode.fascinator.api.roles.RolesException

setConfig

public void setConfig(com.googlecode.fascinator.common.JsonSimpleConfig config)
               throws IOException
Throws:
IOException

shutdown

public void shutdown()
              throws com.googlecode.fascinator.api.roles.RolesException
Specified by:
shutdown in interface com.googlecode.fascinator.api.Plugin
Throws:
com.googlecode.fascinator.api.roles.RolesException

getRoles

public String[] getRoles(String username)
Find and return all roles this user has.

Specified by:
getRoles in interface com.googlecode.fascinator.api.roles.Roles
Parameters:
username - The username of the user.
Returns:
An array of role names (String).

getUsersInRole

public String[] getUsersInRole(String role)
Returns a list of users who have a particular role.

Specified by:
getUsersInRole in interface com.googlecode.fascinator.api.roles.Roles
Parameters:
role - The role to search for.
Returns:
An array of usernames (String) that have that role.

supportsRoleManagement

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

Specified by:
supportsRoleManagement in interface com.googlecode.fascinator.api.roles.Roles
Returns:
true/false reponse.

setRole

public void setRole(String username,
                    String newrole)
             throws com.googlecode.fascinator.api.roles.RolesException
Assign a role to a user.

Specified by:
setRole in interface com.googlecode.fascinator.api.roles.Roles
Parameters:
username - The username of the user.
newrole - The new role to assign the user.
Throws:
com.googlecode.fascinator.api.roles.RolesException - if there was an error during assignment.

removeRole

public void removeRole(String username,
                       String oldrole)
                throws com.googlecode.fascinator.api.roles.RolesException
Remove a role from a user.

Specified by:
removeRole in interface com.googlecode.fascinator.api.roles.Roles
Parameters:
username - The username of the user.
oldrole - The role to remove from the user.
Throws:
com.googlecode.fascinator.api.roles.RolesException - if there was an error during removal.

createRole

public void createRole(String rolename)
                throws com.googlecode.fascinator.api.roles.RolesException
Create a role.

Specified by:
createRole in interface com.googlecode.fascinator.api.roles.Roles
Parameters:
rolename - The name of the new role.
Throws:
com.googlecode.fascinator.api.roles.RolesException - if there was an error creating the role.

deleteRole

public void deleteRole(String rolename)
                throws com.googlecode.fascinator.api.roles.RolesException
Delete a role.

Specified by:
deleteRole in interface com.googlecode.fascinator.api.roles.Roles
Parameters:
rolename - The name of the role to delete.
Throws:
com.googlecode.fascinator.api.roles.RolesException - if there was an error during deletion.

renameRole

public void renameRole(String oldrole,
                       String newrole)
                throws com.googlecode.fascinator.api.roles.RolesException
Rename a role.

Specified by:
renameRole in interface com.googlecode.fascinator.api.roles.Roles
Parameters:
oldrole - The name role currently has.
newrole - The name role is changing to.
Throws:
com.googlecode.fascinator.api.roles.RolesException - if there was an error during rename.

searchRoles

public String[] searchRoles(String search)
                     throws com.googlecode.fascinator.api.roles.RolesException
Returns a list of roles matching the search.

Specified by:
searchRoles in interface com.googlecode.fascinator.api.roles.Roles
Parameters:
search - The search string to execute.
Returns:
An array of role names that match the search.
Throws:
com.googlecode.fascinator.api.roles.RolesException - if there was an error searching.


Copyright © 2009-2012. All Rights Reserved.