Package org.wso2.carbon.hostobjects.sso.internal.util

## Class Util

- java.lang.Object
- - org.wso2.carbon.hostobjects.sso.internal.util.Util

-     public class Util
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Util()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static org.opensaml.xml.XMLObject` | `buildXMLObject​(QName objectQName)` |
    `static String` | `createID()` | Generates a unique Id for Authentication Requests
    `static String` | `decode​(String encodedStr)` | Decoding and deflating the encoded AuthReq
    `static void` | `doBootstrap()` | This method is used to initialize the OpenSAML2 library.
    `static String` | `encode​(String xmlString)` | Compressing and Encoding the response
    `static String` | `getDomainName​(org.opensaml.xml.XMLObject samlObject)` |
    `static org.wso2.carbon.user.core.service.RealmService` | `getRealmService()` |
    `static String` | `marshall​(org.opensaml.xml.XMLObject xmlObject)` | Serializing a SAML2 object into a String
    `static void` | `setRealmService​(org.wso2.carbon.user.core.service.RealmService realmService)` |
    `static org.opensaml.xml.XMLObject` | `unmarshall​(String authReqStr)` | Constructing the XMLObject Object from a String
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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()