Class 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 Detail

      • loggingEnabled

        protected boolean loggingEnabled
    • 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:
        isEnabled in interface org.oa4mp.delegation.server.server.claims.ClaimSource
        Overrides:
        isEnabled in class BasicClaimsSourceImpl
      • 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.UnsupportedScopeException
        Description copied from class: BasicClaimsSourceImpl
        This is the actual place to put your code that only processes the claim source. The BasicClaimsSourceImpl.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:
        realProcessing in class BasicClaimsSourceImpl
        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)
      • 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 a NamingEnumeration and 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:
        debug in interface edu.uiuc.ncsa.security.core.Logable
      • isDebugOn

        public boolean isDebugOn()
        Specified by:
        isDebugOn in interface edu.uiuc.ncsa.security.core.Logable
      • setDebugOn

        public void setDebugOn​(boolean setOn)
        Specified by:
        setDebugOn in interface edu.uiuc.ncsa.security.core.Logable
      • info

        public void info​(String x)
        Specified by:
        info in interface edu.uiuc.ncsa.security.core.Logable
      • warn

        public void warn​(String x)
        Specified by:
        warn in interface edu.uiuc.ncsa.security.core.Logable
      • error

        public void error​(String x)
        Specified by:
        error in interface edu.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
      • fromQDL

        public void fromQDL​(org.qdl_lang.variables.QDLStem arg)
        Specified by:
        fromQDL in interface org.oa4mp.delegation.server.server.claims.ClaimSource
        Overrides:
        fromQDL in class BasicClaimsSourceImpl
      • toQDL

        public org.qdl_lang.variables.QDLStem toQDL()
        Specified by:
        toQDL in interface org.oa4mp.delegation.server.server.claims.ClaimSource
        Overrides:
        toQDL in class BasicClaimsSourceImpl
      • 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:
        getConfiguration in interface org.oa4mp.delegation.server.server.claims.ClaimSource
        Overrides:
        getConfiguration in class BasicClaimsSourceImpl
        Returns: