Class LDAPClaimsSource
- java.lang.Object
-
- org.oa4mp.server.loader.oauth2.claims.BasicClaimsSourceImpl
-
- org.oa4mp.server.loader.oauth2.claims.LDAPClaimsSource
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Logable,Serializable,org.oa4mp.delegation.server.server.claims.ClaimSource
- Direct Known Subclasses:
NCSALDAPClaimSource
public class LDAPClaimsSource extends BasicClaimsSourceImpl implements edu.uiuc.ncsa.security.core.Logable
Created by Jeff Gaynor
on 4/26/16 at 3:32 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected LdapContextcontextprotected booleanloggingEnabled-
Fields inherited from class org.oa4mp.server.loader.oauth2.claims.BasicClaimsSourceImpl
groupHandler
-
-
Constructor Summary
Constructors Constructor Description LDAPClaimsSource()LDAPClaimsSource(org.oa4mp.delegation.server.server.config.LDAPConfiguration ldapConfiguration, edu.uiuc.ncsa.security.core.util.MyLoggingFacade myLogger)LDAPClaimsSource(OA2SE oa2SE)LDAPClaimsSource(org.qdl_lang.variables.QDLStem stem)LDAPClaimsSource(org.qdl_lang.variables.QDLStem stem, OA2SE oa2SE)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseConnection()protected static GroupElementconvertToEntry(Attributes a)LdapContextcreateConnection(edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger)Hashtable<String,String>createEnv(String host, org.oa4mp.delegation.server.server.config.LDAPConfiguration cfg)voiddebug(String x)voiderror(String x)voiderror(String x, Throwable e)voidfromQDL(org.qdl_lang.variables.QDLStem arg)static Groupsget_NEW_Gid(org.oa4mp.delegation.server.server.config.LDAPConfiguration cfg2, String username)Collection<String>getClaims()returns a (unique) collection of claims.org.oa4mp.delegation.server.server.claims.ClaimSourceConfigurationgetConfiguration()Lazy initialization since it is assumed that this is needed to populate this from JSON or QDL.org.oa4mp.delegation.server.server.config.LDAPConfigurationgetLDAPCfg()Convenience to cast the configuration to the right class.protected edu.uiuc.ncsa.security.core.util.MyLoggingFacadegetMyLogger()protected StringgetSearchFilterAttribute(edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger)StringgetSearchName(net.sf.json.JSONObject claims, javax.servlet.http.HttpServletRequest request, org.oa4mp.delegation.server.ServiceTransaction transaction)Returns the name of the user for whom the search is to be run.voidhandleException(Throwable throwable, edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger)voidinfo(String x)booleanisDebugOn()booleanisEnabled()protected booleanisLoggedOn()protected booleanisNCSA()voidlogon(edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugUtil)protected GroupsprocessNCSAGroups()protected net.sf.json.JSONObjectrealProcessing(net.sf.json.JSONObject claims, javax.servlet.http.HttpServletRequest request, org.oa4mp.delegation.server.ServiceTransaction transaction)This is the actual place to put your code that only processes the claim source.protected voidsayit(String x)voidsetDebugOn(boolean setOn)net.sf.json.JSONObjectsimpleSearch(LdapContext ctx, String userID, Map<String,org.oa4mp.delegation.server.server.config.LDAPConfigurationUtil.AttributeEntry> attributes, edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger)protected net.sf.json.JSONObjecttoJSON(Map<String,org.oa4mp.delegation.server.server.config.LDAPConfigurationUtil.AttributeEntry> attributes, NamingEnumeration e, String userName)This takes the result of the search as aNamingEnumerationand set of attributes (from the configuration file) and returns a JSON object.org.qdl_lang.variables.QDLStemtoQDL()StringtoString()voidwarn(String x)-
Methods inherited from class org.oa4mp.server.loader.oauth2.claims.BasicClaimsSourceImpl
addToStem, getGroupHandler, getOa2SE, getOmitList, getScopes, hasConfiguration, isRunOnlyAtAuthorization, process, process, setConfiguration, setGroupHandler, setOa2SE, setOmitList, setScopes
-
-
-
-
Field Detail
-
loggingEnabled
protected boolean loggingEnabled
-
context
protected transient LdapContext context
-
-
Constructor Detail
-
LDAPClaimsSource
public LDAPClaimsSource()
-
LDAPClaimsSource
public LDAPClaimsSource(org.qdl_lang.variables.QDLStem stem)
-
LDAPClaimsSource
public LDAPClaimsSource(org.qdl_lang.variables.QDLStem stem, OA2SE oa2SE)
-
LDAPClaimsSource
public LDAPClaimsSource(org.oa4mp.delegation.server.server.config.LDAPConfiguration ldapConfiguration, edu.uiuc.ncsa.security.core.util.MyLoggingFacade myLogger)
-
LDAPClaimsSource
public LDAPClaimsSource(OA2SE oa2SE)
-
-
Method Detail
-
getSearchName
public String getSearchName(net.sf.json.JSONObject claims, javax.servlet.http.HttpServletRequest request, org.oa4mp.delegation.server.ServiceTransaction transaction)
Returns the name of the user for whom the search is to be run. The default is to return the name the user used to log in to MyProxy. Otherwise, this takes a key for the user information and returns the value it finds there. Note that if you specify an email, the whole email will be returned. Otherwise, the name will be truncated at the "@" sign (e.g. like an eppn).- Parameters:
claims-request-transaction-- Returns:
-
isNCSA
protected boolean isNCSA()
-
getMyLogger
protected edu.uiuc.ncsa.security.core.util.MyLoggingFacade getMyLogger()
-
handleException
public void handleException(Throwable throwable, edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger)
-
processNCSAGroups
protected Groups processNCSAGroups()
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Overrides:
isEnabledin classBasicClaimsSourceImpl
-
realProcessing
protected net.sf.json.JSONObject realProcessing(net.sf.json.JSONObject claims, javax.servlet.http.HttpServletRequest request, org.oa4mp.delegation.server.ServiceTransaction transaction) throws org.oa4mp.delegation.server.server.UnsupportedScopeExceptionDescription copied from class:BasicClaimsSourceImplThis is the actual place to put your code that only processes the claim source. TheBasicClaimsSourceImpl.process(JSONObject, HttpServletRequest, ServiceTransaction)calls wrap this and invoke the pre/post processor for you. Your code should take whatever metadata is for the user and add it to the claims object.- Overrides:
realProcessingin classBasicClaimsSourceImpl- Returns:
- Throws:
org.oa4mp.delegation.server.server.UnsupportedScopeException
-
isLoggedOn
protected boolean isLoggedOn()
-
getLDAPCfg
public org.oa4mp.delegation.server.server.config.LDAPConfiguration getLDAPCfg()
Convenience to cast the configuration to the right class.- Returns:
-
logon
public void logon(edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugUtil)
-
createEnv
public Hashtable<String,String> createEnv(String host, org.oa4mp.delegation.server.server.config.LDAPConfiguration cfg)
-
createConnection
public LdapContext createConnection(edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger)
-
getClaims
public Collection<String> getClaims()
Description copied from class:BasicClaimsSourceImplreturns a (unique) collection of claims.- Specified by:
getClaimsin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Overrides:
getClaimsin classBasicClaimsSourceImpl
-
getSearchFilterAttribute
protected String getSearchFilterAttribute(edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger)
-
simpleSearch
public net.sf.json.JSONObject simpleSearch(LdapContext ctx, String userID, Map<String,org.oa4mp.delegation.server.server.config.LDAPConfigurationUtil.AttributeEntry> attributes, edu.uiuc.ncsa.security.core.util.MetaDebugUtil debugger) throws NamingException
- Throws:
NamingException
-
toJSON
protected net.sf.json.JSONObject toJSON(Map<String,org.oa4mp.delegation.server.server.config.LDAPConfigurationUtil.AttributeEntry> attributes, NamingEnumeration e, String userName) throws NamingException
This takes the result of the search as aNamingEnumerationand set of attributes (from the configuration file) and returns a JSON object. The default is that singletons are returned as simple values while lists are recorded as arrays.- Parameters:
attributes-e-- Returns:
- Throws:
NamingException
-
closeConnection
protected void closeConnection()
-
sayit
protected void sayit(String x)
-
debug
public void debug(String x)
- Specified by:
debugin interfaceedu.uiuc.ncsa.security.core.Logable
-
isDebugOn
public boolean isDebugOn()
- Specified by:
isDebugOnin interfaceedu.uiuc.ncsa.security.core.Logable
-
setDebugOn
public void setDebugOn(boolean setOn)
- Specified by:
setDebugOnin interfaceedu.uiuc.ncsa.security.core.Logable
-
info
public void info(String x)
- Specified by:
infoin interfaceedu.uiuc.ncsa.security.core.Logable
-
warn
public void warn(String x)
- Specified by:
warnin interfaceedu.uiuc.ncsa.security.core.Logable
-
error
public void error(String x)
- Specified by:
errorin interfaceedu.uiuc.ncsa.security.core.Logable
-
get_NEW_Gid
public static Groups get_NEW_Gid(org.oa4mp.delegation.server.server.config.LDAPConfiguration cfg2, String username) throws Throwable
- Throws:
Throwable
-
convertToEntry
protected static GroupElement convertToEntry(Attributes a) throws NamingException
- Throws:
NamingException
-
fromQDL
public void fromQDL(org.qdl_lang.variables.QDLStem arg)
- Specified by:
fromQDLin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Overrides:
fromQDLin classBasicClaimsSourceImpl
-
toQDL
public org.qdl_lang.variables.QDLStem toQDL()
- Specified by:
toQDLin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Overrides:
toQDLin classBasicClaimsSourceImpl
-
getConfiguration
public org.oa4mp.delegation.server.server.claims.ClaimSourceConfiguration getConfiguration()
Lazy initialization since it is assumed that this is needed to populate this from JSON or QDL.- Specified by:
getConfigurationin interfaceorg.oa4mp.delegation.server.server.claims.ClaimSource- Overrides:
getConfigurationin classBasicClaimsSourceImpl- Returns:
-
-