Friday, July 21, 2017

Integration Security using OAuth and JWT

Integration Security used to be an important point for any project Implementation. Oracle Fusion Middleware components provide various type of Security features, commonly SSL Certificates, OSB Service Accounts, OWSM Security Policies like Username Token, SAML Token, HTTP Token etc. But there are few more security features which we can use out of the box for more secured integration design like OAuth and JWT Security.
For implementing OAuth and JWT we will first understand what are these related to and how it will contribute to Integration.

What is OAuth and JWT Security features?

OAuth is an open standard for access delegation, commonly used as a way for Internet users to grant websites or applications access to their information on other websites but without giving them the passwords. Generally, OAuth provides to clients a "secure delegated access" to server resources on behalf of a resource owner. It specifies a process for resource owners to authorize third-party access to their server resources without sharing their credentials. Designed specifically to work with Hypertext Transfer Protocol (HTTP), OAuth essentially allows access tokens to be issued to third-party clients by an authorization server, with the approval of the resource owner. The third party then uses the access token to access the protected resources hosted by the resource server.
A JSON Web Token (JWT) is a JSON object which is composed of a token and is a safe way to represent a set of information between two parties. The token is composed of a header, a payload, and a signature.
The JWT Token should be build as a base64encoded string in format “header.payload.signature”.
As JWT is a Jason object so the JWT Header, will be a JSON format data with Key’s for Authorization and Algorithm Type (as below format)
{
    "typ": "JWT",
    "alg": "HS256"
}
In a similar way, JWT Payload will also be a JSON format data as below.
{
    "userId": "b08f86af-35da-48f2-8fab-cef3904660bd"
}
The JWT Signature will be computed with the algorithm as below,
data = base64urlEncode( header ) + “.” + base64urlEncode( payload )
signature = Hash( data, secret );

Implementing OAuth and JWT with Oracle SOA

OAuth uses digital signatures instead of sending the full credentials with each request. Digital signatures help the recipient to verify that the content of the request hasn’t changed in transit.
OAuth is an Out of the Box security functionality which can be embedded with Oracle SOA Rest Services. In Oracle Service Bus 12.2.1, we can secure services with REST endpoints by attaching OAuth OWSM policies, for which we must configure OWSM and the OAuth server to secure REST endpoints with OAuth policies in Service Bus.
Note: The Server Configurations for OAuth are described can be accessed from “Configure OAuth Server
As OAuth being a authorization security feature only, so it uses JWT to secure the services. For OAuth and JWT configurations with OWSM policies are described here.
Post configuration of the OAuth Server with OWSM, we can attach the OWSM Security policies with the OSB Proxy and Business Services as below.
The oracle/http_jwt_token_service_policy or oracle/http_jwt_token_over_ssl_service_policy policies can be attached to proxy services, and the oracle/http_oauth2_token_client_policy or oracle/http_oauth2_token_over_ssl_client_policy policies can be attached to business services.

References:
https://docs.oracle.com/middleware/1221/osb/develop/toc.htm 
https://medium.com/vandium-software/5-easy-steps-to-understanding-json-web-tokens-jwt-1164c0adfcec
https://en.wikipedia.org/wiki/OAuth 

Friday, May 12, 2017

Handle SOAP Version Mismatch issue using OSB

What is SOAP?
SOAP is a protocol specification for exchanging structured information in the implementation of web services in computer networks. Its purpose is to induce extensibility, neutrality and independence.

Difference Between SOAP 1.1 and SOAP 1.2
SOAP Version 1.2 can do everything that SOAP/1.1 does, and more. Below are some of the properties SOAP 1.2 has over SOAP 1.1.
  • Provides clear processing model
  • Testing and implementation requirements leads to better interoperability
  • Based on XML Information Set i.e. it is specified as an Infoset which is carried from one SOAP node to another. While SOAP/1.1 was based on XML 1.0 serialization
  • Gives developers protocol independence by providing a binding framework
  • Includes HTTP binding for better integration to the World Wide Web
  • Delivers a very well-defined extensibility model
  • Has better support for Web standards


WSDL changes observed in SOAP-1.2
  1. Namespace Changes: SOAP 1.2 supports below namespace definition.


xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
  1. SOAP 1.2 uses "application/soap+xml" as Content-Type and SOAP 1.1 uses "text/xml".
  2.  SOAP:Operation and SOAP Binding need to be specified in SOAP 1.2 WSDL

Use Case Scenario:
We had a requirement where we should create a OSB service which should call first a SOAP1.2 web service (say as service-A) and get data from the service-A. Then the OSB service need to add the retrieved data from service-A and call up another SOAP service based on SOAP 1.1 (say as service-B) to process the data.
In this scenario we have created a OSB Service which was build on a WSDL which was first calling Service-A and then Service-B, but during Testing of the OSB Service, we found that services were failing due to SOAP version mismatch issue as Service-B is built on SOAP version 1.1 and Service-A  being a latest release services are built on SOAP Version 1.2.
Solution
To overcome this versioning issue, we have followed below steps:
1.       Generate the OSB Proxy as a Message Based Proxy service which will be based on the XSD which will have only the “body” part with required parameters to call Service-A and Service-B.
2.       Create a Pipeline Service based on the same methodology explained in point#1.
3.       In the Pipeline Service, go to message flow and add a pipeline pair and rename it as per the process standards.
4.       In the Request Pipeline node, add a Stage and renamed it as per standards.
5.       Inside the stage, add a Service callout, and browse for the proxy service for wrapper of Service-A or business service of Service-A, and configure the Service Callout as shown in below diagram, and assign the required message to Service-A parameters.


6.       Now after the above Pipeline Pair, add a RouteNode .
7.       Inside the Route Node add a Routing Operation and configure the same for the Business Service  of Service-B
8.       Inside the Request Actions, assign or replace the Body and Header to make a successful call for Business Service. Below snapshot will help on the same.


Wednesday, March 1, 2017

CSF Key Credentials Configurations Programmatically

Hello Friends,

Today I am sharing with you all my experience over the CSF Key Credentials Configurations for Creating, Updating and Deleting the CSF Keys.
We can find many Blog Posts to Read the CSF Configurations using a BPEL Process etc. but for Creation, Updation and Deletion we have only 2 ways:

  • Manual Configurations via EM Console
  • Using WLST Scripts
I have already shared with you in my earlier posts the steps to configure the Key using EM console. Today I will sharing the other part like how we can do it Programmatically.

For WLST Script execution, we need to first login to WLST utility, and then execute the commands.

Below steps will help us on the same.
  • Open Command Prompt or Shell Terminal
  • cd <<ORACLE_HOME>>/wlserver/common/bin
  • For CMD type "wlst" and enter, for unix ./wlst
  • connect('weblogic','welcome1','t3://localhost:7001')
The above commands will log in us to the server using WLST prompt. Now execute below commands:

For CSF Key Creation:
createCred(map=<<keyMapName>>,key=<<keyName>>,user=<<keyUser>>,password=<<keyPass>>,desc=<<keyDesc>>)



For CSF Key Updation:
updateCred(map=<<keyMapName>>,key=<<keyName>>,user=<<keyUser>>,password=<<keyPass>>,desc=<<keyDesc>>)


For CSF Key Deletion:
deleteCred(map=<<keyMapName>>,key=<<keyName>>)

If we want to automate the above functionality during deployment time, then we can use the ANT Scripts as well.

Below ANT Target will focus on the same.


    <target name="createCSFKeyCred">
        <wlst debug="false" arguments="${admin.username} ${admin.password} ${admin.server} ${map} ${keyCredentialsName} ${user} ${password} ${desc}">
            <script>
            adminUser=sys.argv[0]
            adminPassword=sys.argv[1]
            adminUrl=sys.argv[2]
            keyMap=sys.argv[3]
            keyName=sys.argv[4]
            keyUser=sys.argv[5]
            keyPass=sys.argv[6]
            keyDesc=sys.argv[7]
            print('Connecting to WLST Server')
            connect (adminUser,adminPassword,adminUrl)
            print('Creating Security Credentials')
            createCred(map=keyMap,key=keyName,user=keyUser,password=keyPass,desc=keyDesc)
            disconnect()
            print('Disconnecting....')
            </script>
        </wlst>
    </target>

I hope these things will help you.

Please help with your feedback.

You can also view the post @
http://blogs.astcorporation.com/middleware/2017/02/28/automating-csf-key-credentials-configurations/

Tuesday, November 1, 2016

A workaround for Data Control Refresh in BPM-ADF Application

Hello Everyone,

Today i will be sharing my experience over the issue I have been facing related to data control refresh in BPM-ADF application, like if you add or delete or change any element in Human Task then it will not directly update the existing data controls in the existing ADF Project but creats a new adf related folder structure and duplicate dcx files in BPM project only.

For this issue, I have found a workaround to let the JDeveloper create new files for data controls and then carefully replace the ADF project files with the newly generated files. This process need to be done with proper backups of the code.

Then restart the JDeveloper and issue stands resolved.

I hope my this learning would be helpful.

Greetings,
Ankit Chhabra

Monday, October 31, 2016

Creating ADF Portal based on a properties file

Hello Everyone,

This post is based on a requirement where we need to creat a ADF page which should have a table based on data present in a properties file, and the table need to be populate data on page load.

For this, I have created a JSF page and added the property file as a resource bundle to the Faces.config file. These configs will be accessible as a value bindings to the table columns.

This solution helped me to achieve my requirement.

Hope it will help others too....

Have a great day!!!!

Greetings,
Ankit Chhabra

Sunday, December 20, 2015

Using Properties File with Java Code in SOA12c

-------------------------------------------------------------------
This blog post contains few points which I learnt through my experience while working in Oracle SOA 12c Server Setup and Deployments.
-------------------------------------------------------------------- 
I was working on a issue where I have to read properties file called in a Java Code through BPEL component. We copied the file in the code location, but post deployment it is not bee called by Java Class file. Then the best way we found to read the file as a Library present in SCA-INF folder, and this resolved our issue.

So, while calling a properties or any other file to be used by SOA component is to copy in <<Code_Location>>/sca-inf/lib folder.

Note:- This workaround is used when you are not allowed to copy the file at some server location or not allowed to copy it in MDS.

Please help me with your feedback and comments.

Tuesday, December 15, 2015

Import MDS in SOA 12c without using WLST Scripts

-------------------------------------------------------------------
This blog post contains few points which I learnt through my experience while working in Oracle SOA 12c Server Setup and Deployments.
--------------------------------------------------------------------

In this post we will be going over the steps for Importing MDS in SOA 12c without using WLST Commands.

Before going over the Deployment steps, here are few of the Pre-Requisites to perform the deployment and verification.
  1. We should be having Admin access to the server.
  2. We should be having DB Credentials of MDS for verification.
  3. The Files need to be imported should be available.
Using below steps we would be able to import the MDS.
  1. Open JDeveloper 12c, and Create a New SOA Application "MDSApplication".
  2. Create a Projects with Folder structure you want your MDS looks like.
  3. Import the WSDL's and XSD's and Other files which you want in your MDS, in your Project.
  4. Compile your Application and Check for any errors.
  5. Create a New Deployment Profile for your application, and choose the application type of "SOABundle"
  6. Under Files Section, Select the project jar files of your MDSApplication, so it would be imported in MDS.
  7. Now Deploy your MDSApplication and Create a Jar File of the same.
  8. Once Jar is prepared, Login to SOA Em Console
  9. Go To SOA, and Right Click On SOA_INFRA and Go To Administration --> MDS Configuration.
  10. For Import of MDS, choose the option provided by default and Browse the file generated in Step#7, and click Import.
  11. Repeat the Step#9 and #10 for other Managed Servers as well.
This Process will Import your DB Based MDS. For Verification create a SOA-MDS Resource in your JDeveloper IDE and provide the MDS Credentials used during Installation.

I hope this will be helpful. Feedback is always welcome....

B2B Features with OIC

During last couple of months various new features are getting introduced in Oracle Integration Cloud, out of those there is a new feature f...