Querying the trust service using wsadmin scripting

Use the wsadmin tool, which supports the Jython and Jacl scripting languages, to query the trust service for existing configuration settings. Use the commands in this topic to view current trust service configurations before adding, removing, or editing token provider and endpoint configurations.

About this task

Query your current token provider configurations or endpoint configurations using the STSManagement group of commands. Use the following Jython syntax command examples when writing automation scripts to retrieve configuration attributes and set the output to a variable. Pass the newly set variable to administrative commands in the STSManagement group to automate the editing of token provider and endpoint configurations.

Procedure

  • Use the following command examples to query the trust service for token provider configurations.
    • Determine the local name of the default token provider and set it to the myDefaultTokenType variable.
      The following command sets the myDefaultTokenType variable to the local name string for the default token provider:
      myDefaultTokenType = AdminTask.querySTSDefaultTokenType()
      print myDefaultTokenType
    • List the local names of each configured token provider.
      The following command sets the myTokenTypes variable to an array containing the local names of the configured token providers:
      myTokenTypes = AdminTask.listSTSConfiguredTokenTypes()
      print myTokenTypes
    • Display the non-custom properties for the default token provider.
      The following command returns a java.util.Properties instance that contains the values for each non-custom property for the default token provider stored in the myDefaultTokenType variable.
      AdminTask.querySTSTokenTypeConfigurationDefaultProperties(myDefaultTokenType)
      To use this command to query a specific token provider, use the following Jython syntax:
      AdminTask.querySTSTokenTypeConfigurationDefaultProperties('"Security Context Token"')
    • Display a properties object containing all custom properties for a token provider configuration.
      The following command returns a java.util.Properties instance that contains the values for each of the custom properties for the token provider stored in the myDefaultTokenType variable.
      AdminTask.querySTSTokenTypeConfigurationCustomProperties(myDefaultTokenType)
      To use this command to query a specific token provider, use the following Jython syntax:
      AdminTask.querySTSTokenTypeConfigurationCustomProperties('"Security Context Token"')
  • Use the following command examples to query endpoint target configurations and security constraints for endpoint targets.
    • Display each uniform resource identifier (URI) for each assigned endpoint.
      The following command sets the allMyURIs variable to an array containing the URIs for each assigned endpoint:
      allMyURIs = AdminTask.listSTSAssignedEndpoints()
      print allMyURIs
    • Display the token provider that is assigned to a specific endpoint URI.
      The following command sets the myTokenType variable to the name of the token provider that is assigned to the http://myserver.mysom.com:9080/Example endpoint URI:
      myTokenType = AdminTask.querySTSEndpointTokenType('http://myserver.mysom.com:9080/Example')
      print myTokenType

What to do next

Use the wsadmin tool to manage and edit token provider and endpoint configurations.