Class LocalSTSClient


  • public class LocalSTSClient
    extends java.lang.Object
    A client used to invoke locally configured STS chains. The requests go via a bean interface, not over the SOAP interface. Here is an example invocation. Use the IDMappingExtUtils to simplify working with document/node objects
     importClass(Packages.com.tivoli.am.fim.fedmgr2.trust.util.LocalSTSClient);
     importClass(Packages.com.tivoli.am.fim.trustserver.sts.utilities.IDMappingExtUtils);
    
     // Parse a base token. In this case a BinarySecurityToken containing a JWT.
     var base_token = IDMappingExtUtils.stringToXMLElement("eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.Dt2W1GtOLnnqf4-PUr5Ns_9BuLLmwpWO5zBwN4fokX4");
    
     // Validate the token using the chain with isser and appliesTo value of 'jwt:validate', do not pass any claims.
      var res = LocalSTSClient.doRequest("http://schemas.xmlsoap.org/ws/2005/02/trust/Validate", "jwt:validate","jwt:validate", base_token, null)
      if (res.errorMessage == null) {
        var result_element_string = IDMappingExtUtils.xmlElementToString(res.token);
        IDMappingExtUtils.traceString("got result: " + result_element_string);
        // Do something with the result.
      } else {
        IDMappingExtUtils.throwSTSException("An error occurred invoking the STS: " + res.errorMessage);
      }
    
     
    • Constructor Summary

      Constructors 
      Constructor Description
      LocalSTSClient()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static LocalSTSClient.LocalSTSClientResult doRequest​(java.lang.String requestType, java.lang.String appliesTo, java.lang.String issuer, org.w3c.dom.Element base, org.w3c.dom.Element claims)
      Invoke the STS locally using a appliesTo and issuer for chain determination.
      static LocalSTSClient.LocalSTSClientResult doRequest​(java.lang.String requestType, java.lang.String tokenType, org.w3c.dom.Element base, org.w3c.dom.Element claims)
      Invoke the STS locally using a token-type for chain determination.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocalSTSClient

        public LocalSTSClient()
    • Method Detail

      • doRequest

        public static LocalSTSClient.LocalSTSClientResult doRequest​(java.lang.String requestType,
                                                                    java.lang.String appliesTo,
                                                                    java.lang.String issuer,
                                                                    org.w3c.dom.Element base,
                                                                    org.w3c.dom.Element claims)
        Invoke the STS locally using a appliesTo and issuer for chain determination. 'base' will be added as a child node of the WS-Trust base token element. 'claims' will be added as a child node of the WS-Trust claims element.
        Parameters:
        requestType - WS-trust request type to use.
        appliesTo - used for chain determination.
        issuer - used fo chain determination.
        base - token to present.
        claims - to include in the request.
      • doRequest

        public static LocalSTSClient.LocalSTSClientResult doRequest​(java.lang.String requestType,
                                                                    java.lang.String tokenType,
                                                                    org.w3c.dom.Element base,
                                                                    org.w3c.dom.Element claims)
        Invoke the STS locally using a token-type for chain determination. 'base' will be added as a child node of the WS-Trust base token element. 'claims' will be added as a child node of the WS-Trust claims element.
        Parameters:
        requestType - WS-trust request type to use.
        tokenType - used for chain determination.
        base - token to present.
        claims - to include in the request.