Class Util


  • public class Util
    extends Object
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • doBootstrap

        public static void doBootstrap()
        This method is used to initialize the OpenSAML2 library. It calls the bootstrap method, if it is not initialized yet.
      • buildXMLObject

        public static org.opensaml.xml.XMLObject buildXMLObject​(QName objectQName)
                                                         throws Exception
        Throws:
        Exception
      • createID

        public static String createID()
        Generates a unique Id for Authentication Requests
        Returns:
        generated unique ID
      • unmarshall

        public static org.opensaml.xml.XMLObject unmarshall​(String authReqStr)
                                                     throws Exception
        Constructing the XMLObject Object from a String
        Parameters:
        authReqStr -
        Returns:
        Corresponding XMLObject which is a SAML2 object
        Throws:
        Exception
      • marshall

        public static String marshall​(org.opensaml.xml.XMLObject xmlObject)
                               throws Exception
        Serializing a SAML2 object into a String
        Parameters:
        xmlObject - object that needs to serialized.
        Returns:
        serialized object
        Throws:
        Exception
      • encode

        public static String encode​(String xmlString)
                             throws Exception
        Compressing and Encoding the response
        Parameters:
        xmlString - String to be encoded
        Returns:
        compressed and encoded String
        Throws:
        Exception
      • decode

        public static String decode​(String encodedStr)
                             throws Exception
        Decoding and deflating the encoded AuthReq
        Parameters:
        encodedStr - encoded AuthReq
        Returns:
        decoded AuthReq
        Throws:
        Exception
      • validateSignature

        public static boolean validateSignature​(org.opensaml.saml2.core.Response resp,
                                                String keyStoreName,
                                                String keyStorePassword,
                                                String alias,
                                                int tenantId,
                                                String tenantDomain)
        This method validates the signature of the SAML Response.
        Parameters:
        resp - SAML Response
        Returns:
        true, if signature is valid.
      • getDomainName

        public static String getDomainName​(org.opensaml.xml.XMLObject samlObject)
      • setRealmService

        public static void setRealmService​(org.wso2.carbon.user.core.service.RealmService realmService)
      • getRealmService

        public static org.wso2.carbon.user.core.service.RealmService getRealmService()