Package org.wso2.carbon.hostobjects.sso

## Class SAMLSSORelyingPartyObject

- java.lang.Object
- - org.mozilla.javascript.ScriptableObject
  - - org.wso2.carbon.hostobjects.sso.SAMLSSORelyingPartyObject

- All Implemented Interfaces:
    `Serializable`, `org.mozilla.javascript.ConstProperties`, `org.mozilla.javascript.debug.DebuggableObject`, `org.mozilla.javascript.Scriptable`

      public class SAMLSSORelyingPartyObject
      extends org.mozilla.javascript.ScriptableObject

  This class wrap up the operations needed to write a saml relying party for sso use case.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.mozilla.javascript.ScriptableObject

      `CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST`

    - ### Fields inherited from interface org.mozilla.javascript.Scriptable

      `NOT_FOUND`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static String` | `decode​(String xmlString)` | Decode xml
    `String` | `getClassName()` |
    `static org.mozilla.javascript.Scriptable` | `jsConstructor​(org.mozilla.javascript.Context cx, Object[] args, org.mozilla.javascript.Function ctorObj, boolean inNewExpr)` |
    `static String` | `jsFunction_decode​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Decoding and deflating the encoded AuthReq
    `static String` | `jsFunction_encode​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Compressing and Encoding the response
    `static String` | `jsFunction_getIdentitySessionId​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` |
    `static String` | `jsFunction_getLoggedInUser​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` |
    `static String` | `jsFunction_getProperty​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Get SSO configuration properties.
    `static String` | `jsFunction_getRelayStateProperty​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Get requested URI for relay state.
    `static String` | `jsFunction_getSAMLAuthRequest​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Get SAML authentication request build with given issuer
    `static String` | `jsFunction_getSAMLLogoutRequest​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Get SAML logout request build.
    `static String` | `jsFunction_getSAMLResponseNameId​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Extract the name of authenticated user from SAML response.
    `static String` | `jsFunction_getSAMLToken​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` |
    `static String` | `jsFunction_getUUID​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | generate a UUID
    `static void` | `jsFunction_invalidateSessionBySAMLResponse​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Invalidate current browser authenticated session based on SAML log out request session index value.
    `static void` | `jsFunction_invalidateSessionBySessionId​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Invalidate current browser authenticated session based on session id.
    `static boolean` | `jsFunction_isLogoutRequest​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` |
    `static boolean` | `jsFunction_isLogoutResponse​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` |
    `static boolean` | `jsFunction_isSessionAuthenticated​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Check if the browser session is valid.
    `static void` | `jsFunction_setProperty​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Set SSO Configuration key,values
    `static void` | `jsFunction_setRelayStateProperty​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Set relay state property with requested uri.
    `static void` | `jsFunction_setSessionAuthenticated​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` | Set the current session as authenticated by mapping with current session id to session index.
    `static boolean` | `jsFunction_validateSignature​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` |
    `static String` | `jsFunction_xmlDecode​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` |
    `static String` | `jsFunction_xmlEncode​(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, Object[] args, org.mozilla.javascript.Function funObj)` |

    - ### Methods inherited from class org.mozilla.javascript.ScriptableObject

      `applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, equivalentValues, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasInstance, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size`

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

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

- - ### Constructor Detail

    - #### SAMLSSORelyingPartyObject

          public SAMLSSORelyingPartyObject()

  - ### Method Detail

    - #### getClassName

          public String getClassName()

      Specified by:
        `getClassName` in interface `org.mozilla.javascript.Scriptable`
      Specified by:
        `getClassName` in class `org.mozilla.javascript.ScriptableObject`

    - #### jsConstructor

          public static org.mozilla.javascript.Scriptable jsConstructor​(org.mozilla.javascript.Context cx,
                                                                        Object[] args,
                                                                        org.mozilla.javascript.Function ctorObj,
                                                                        boolean inNewExpr)
                                                                 throws Exception

      Parameters:
        `cx` -
        `args` - - args[0]-issuerId, this issuer need to be registered in Identity server.
        `ctorObj` -
        `inNewExpr` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_validateSignature

          public static boolean jsFunction_validateSignature​(org.mozilla.javascript.Context cx,
                                                             org.mozilla.javascript.Scriptable thisObj,
                                                             Object[] args,
                                                             org.mozilla.javascript.Function funObj)
                                                      throws Exception

      Parameters:
        `cx` -
        `thisObj` -
        `args` - -args[0]- SAML response xml
        `funObj` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_isLogoutRequest

          public static boolean jsFunction_isLogoutRequest​(org.mozilla.javascript.Context cx,
                                                           org.mozilla.javascript.Scriptable thisObj,
                                                           Object[] args,
                                                           org.mozilla.javascript.Function funObj)
                                                    throws Exception

      Parameters:
        `cx` -
        `thisObj` -
        `args` - -args[0]-Logout request xml as a string.
        `funObj` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_isLogoutResponse

          public static boolean jsFunction_isLogoutResponse​(org.mozilla.javascript.Context cx,
                                                            org.mozilla.javascript.Scriptable thisObj,
                                                            Object[] args,
                                                            org.mozilla.javascript.Function funObj)
                                                     throws Exception

      Parameters:
        `cx` -
        `thisObj` -
        `args` - -args[0]- Logout response xml as a string
        `funObj` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_encode

          public static String jsFunction_encode​(org.mozilla.javascript.Context cx,
                                                 org.mozilla.javascript.Scriptable thisObj,
                                                 Object[] args,
                                                 org.mozilla.javascript.Function funObj)
                                          throws Exception

      Compressing and Encoding the response
      Parameters:
        `cx` -
        `thisObj` -
        `args` - -args[0]- string to be encoded.
        `funObj` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_getSAMLToken

          public static String jsFunction_getSAMLToken​(org.mozilla.javascript.Context cx,
                                                       org.mozilla.javascript.Scriptable thisObj,
                                                       Object[] args,
                                                       org.mozilla.javascript.Function funObj)
                                                throws Exception

      Throws:
        `Exception`

    - #### jsFunction_decode

          public static String jsFunction_decode​(org.mozilla.javascript.Context cx,
                                                 org.mozilla.javascript.Scriptable thisObj,
                                                 Object[] args,
                                                 org.mozilla.javascript.Function funObj)
                                          throws Exception

      Decoding and deflating the encoded AuthReq
      Parameters:
        `cx` -
        `thisObj` -
        `args` - -args[0]-String to be decoded
        `funObj` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_getUUID

          public static String jsFunction_getUUID​(org.mozilla.javascript.Context cx,
                                                  org.mozilla.javascript.Scriptable thisObj,
                                                  Object[] args,
                                                  org.mozilla.javascript.Function funObj)
                                           throws Exception

      generate a UUID
      Parameters:
        `cx` -
        `thisObj` -
        `args` -
        `funObj` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_getSAMLAuthRequest

          public static String jsFunction_getSAMLAuthRequest​(org.mozilla.javascript.Context cx,
                                                             org.mozilla.javascript.Scriptable thisObj,
                                                             Object[] args,
                                                             org.mozilla.javascript.Function funObj)
                                                      throws Exception

      Get SAML authentication request build with given issuer
      Parameters:
        `cx` -
        `thisObj` -
        `args` -
        `funObj` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_getSAMLLogoutRequest

          public static String jsFunction_getSAMLLogoutRequest​(org.mozilla.javascript.Context cx,
                                                               org.mozilla.javascript.Scriptable thisObj,
                                                               Object[] args,
                                                               org.mozilla.javascript.Function funObj)
                                                        throws Exception

      Get SAML logout request build.
      Parameters:
        `cx` -
        `thisObj` -
        `args` - -args[0]-the user to be logout
        `funObj` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_getSAMLResponseNameId

          public static String jsFunction_getSAMLResponseNameId​(org.mozilla.javascript.Context cx,
                                                                org.mozilla.javascript.Scriptable thisObj,
                                                                Object[] args,
                                                                org.mozilla.javascript.Function funObj)
                                                         throws Exception

      Extract the name of authenticated user from SAML response.
      Parameters:
        `cx` -
        `thisObj` -
        `args` -
        `funObj` -
      Returns:
      Throws:
        `Exception`

    - #### jsFunction_setProperty

          public static void jsFunction_setProperty​(org.mozilla.javascript.Context cx,
                                                    org.mozilla.javascript.Scriptable thisObj,
                                                    Object[] args,
                                                    org.mozilla.javascript.Function funObj)
                                             throws ScriptException

      Set SSO Configuration key,values
      Parameters:
        `cx` -
        `thisObj` -
        `args` -
        `funObj` -
      Throws:
        `ScriptException`

    - #### jsFunction_isSessionAuthenticated

          public static boolean jsFunction_isSessionAuthenticated​(org.mozilla.javascript.Context cx,
                                                                  org.mozilla.javascript.Scriptable thisObj,
                                                                  Object[] args,
                                                                  org.mozilla.javascript.Function funObj)
                                                           throws ScriptException

      Check if the browser session is valid. If user is log out from any sso service provider, user session is invalidated.
      Parameters:
        `cx` -
        `thisObj` -
        `args` -
        `funObj` -
      Returns:
      Throws:
        `ScriptException`

    - #### jsFunction_getIdentitySessionId

          public static String jsFunction_getIdentitySessionId​(org.mozilla.javascript.Context cx,
                                                               org.mozilla.javascript.Scriptable thisObj,
                                                               Object[] args,
                                                               org.mozilla.javascript.Function funObj)
                                                        throws ScriptException

      Throws:
        `ScriptException`

    - #### jsFunction_getLoggedInUser

          public static String jsFunction_getLoggedInUser​(org.mozilla.javascript.Context cx,
                                                          org.mozilla.javascript.Scriptable thisObj,
                                                          Object[] args,
                                                          org.mozilla.javascript.Function funObj)
                                                   throws ScriptException

      Throws:
        `ScriptException`

    - #### jsFunction_invalidateSessionBySAMLResponse

          public static void jsFunction_invalidateSessionBySAMLResponse​(org.mozilla.javascript.Context cx,
                                                                        org.mozilla.javascript.Scriptable thisObj,
                                                                        Object[] args,
                                                                        org.mozilla.javascript.Function funObj)
                                                                 throws Exception

      Invalidate current browser authenticated session based on SAML log out request session index value.
      Parameters:
        `cx` -
        `thisObj` -
        `args` -
        `funObj` -
      Throws:
        `Exception`

    - #### jsFunction_invalidateSessionBySessionId

          public static void jsFunction_invalidateSessionBySessionId​(org.mozilla.javascript.Context cx,
                                                                     org.mozilla.javascript.Scriptable thisObj,
                                                                     Object[] args,
                                                                     org.mozilla.javascript.Function funObj)
                                                              throws Exception

      Invalidate current browser authenticated session based on session id. Session will be invalidated after user log out request get succeeded.
      Parameters:
        `cx` -
        `thisObj` -
        `args` -
        `funObj` -
      Throws:
        `Exception`

    - #### jsFunction_setSessionAuthenticated

          public static void jsFunction_setSessionAuthenticated​(org.mozilla.javascript.Context cx,
                                                                org.mozilla.javascript.Scriptable thisObj,
                                                                Object[] args,
                                                                org.mozilla.javascript.Function funObj)
                                                         throws Exception

      Set the current session as authenticated by mapping with current session id to session index.
      Parameters:
        `cx` -
        `thisObj` -
        `args` - -args[0]- current session id, args[1]-SAML response
        `funObj` -
      Throws:
        `Exception`

    - #### jsFunction_getProperty

          public static String jsFunction_getProperty​(org.mozilla.javascript.Context cx,
                                                      org.mozilla.javascript.Scriptable thisObj,
                                                      Object[] args,
                                                      org.mozilla.javascript.Function funObj)
                                               throws ScriptException

      Get SSO configuration properties.
      Parameters:
        `cx` -
        `thisObj` -
        `args` - -args[0]-configuration key
        `funObj` -
      Returns:
      Throws:
        `ScriptException`

    - #### jsFunction_setRelayStateProperty

          public static void jsFunction_setRelayStateProperty​(org.mozilla.javascript.Context cx,
                                                              org.mozilla.javascript.Scriptable thisObj,
                                                              Object[] args,
                                                              org.mozilla.javascript.Function funObj)
                                                       throws ScriptException

      Set relay state property with requested uri.
      Parameters:
        `cx` -
        `thisObj` -
        `args` -
        `funObj` -
      Throws:
        `ScriptException`

    - #### jsFunction_getRelayStateProperty

          public static String jsFunction_getRelayStateProperty​(org.mozilla.javascript.Context cx,
                                                                org.mozilla.javascript.Scriptable thisObj,
                                                                Object[] args,
                                                                org.mozilla.javascript.Function funObj)
                                                         throws ScriptException

      Get requested URI for relay state. And relay state value is removed, as relay state is unique and onetime value.
      Parameters:
        `cx` -
        `thisObj` -
        `args` -
        `funObj` -
      Returns:
      Throws:
        `ScriptException`

    - #### jsFunction_xmlDecode

          public static String jsFunction_xmlDecode​(org.mozilla.javascript.Context cx,
                                                    org.mozilla.javascript.Scriptable thisObj,
                                                    Object[] args,
                                                    org.mozilla.javascript.Function funObj)
                                             throws ScriptException

      Throws:
        `ScriptException`

    - #### jsFunction_xmlEncode

          public static String jsFunction_xmlEncode​(org.mozilla.javascript.Context cx,
                                                    org.mozilla.javascript.Scriptable thisObj,
                                                    Object[] args,
                                                    org.mozilla.javascript.Function funObj)
                                             throws ScriptException

      Throws:
        `ScriptException`

    - #### decode

          public static String decode​(String xmlString)

      Decode xml
      Parameters:
        `xmlString` -
      Returns: