Change Basic authentication to OAuth
The default authentication scheme after you install Transact is Basic authentication. With Basic authentication, users can access APIs using the same user name and password that they use to log in to Transact and no additional credentials are required.
OAuth requires creating separate credentials to access REST APIs. These credentials can be created in the Transact Administration console under . To support credentials and authorization using OAuth, the Transact application is delivered with the OAuth Server application which is installed alongside Transact application.
The following topics show the exact changes required to enable OAuth. These changes apply to both Windows and Linux installations.
With standard installation (without SSO)
Make the following changes if Transact is installed with the standard installation (without SSO).
-
Update the
<Transact
Installation Directory>\Application\WEB-INF\web.xml file as follows:
-
Uncomment the
springSecurityFilterChain filter by removing the opening
<!-- and closing
--> tags:
<!-- Uncomment to enable OAuth for REST APIs --> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> -
Comment
security-constraint for web services by adding the
<!-- and
--> tags around the section:
<!-- Comment to disable Basic Authentication and enable OAuth --> <!-- <security-constraint> <web-resource-collection> <web-resource-name>web service</web-resource-name> <url-pattern>/rest/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> <http-method>PATCH</http-method> <http-method>PUT</http-method> <http-method>DELETE</http-method> </web-resource-collection> <auth-constraint> <role-name>*</role-name> </auth-constraint> </security-constraint> -->
-
Uncomment the
springSecurityFilterChain filter by removing the opening
<!-- and closing
--> tags:
-
In the
<Transact
Installation Directory>\Application\applicationContext.xml file, uncomment the
applicationContext-oauth-security.xml import.
<!-- Uncomment to use OAuth for the REST APIs --> <import resource="classpath:/META-INF/applicationContext-oauth-security.xml" />
With SSO installation
When Transact is configured with SSO, make the following changes.
-
In the
<Transact_Install_Dir>\Application\WEB-INF\classes\META-INF\applicationContext-security.xml
file, update
applicationContext-security.xml by commenting the
/rest/** pattern.
<!-- Comment the line below when using OAuth for REST APIs --> <!-- <security:http pattern="/rest/**" security="none" /> --> -
In the
<Transact
Installation Directory>\Application\applicationContext.xml file, update
applicationContext.xml by uncommenting the
applicationContext-oauth-security.xml import.
<!-- Uncomment to use OAuth for the REST APIs --> <import resource="classpath:/META-INF/applicationContext-oauth-security.xml" />