Showing posts with label osb. Show all posts
Showing posts with label osb. Show all posts

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.


Saturday, November 12, 2011

ORACLE BAM Integration with Fusion Middleware 11g


The Oracle BAM Adapter is a Java Connector Architecture (JCA)-compliant adapter which can be used from a Java EE client to send data and events to the Oracle BAM Server. Oracle BAM Adapter is configured in Oracle WebLogic Server Administration Console to provide any of these connection pools. Oracle BAM Adapter provides three mechanisms by which you can send data to Oracle BAM Active Data Cache from an SOA composite application.
Oracle BAM Adapter provides three mechanisms by which you can send data to an Oracle BAM Server in your SOA composite application:
  1.  The Oracle BAM Adapter can be used as a reference binding component in an SOA composite application. For example, Oracle Mediator can send data to Oracle BAM using the Oracle BAM Adapter.
  2. The Oracle BAM Adapter can also be used as a partner link in a Business Process Execution Language (BPEL) process to send data to Oracle BAM as a step in the process.
  3. Oracle BAM sensor actions can be included within a BPEL process to publish event-based data to the Oracle BAM data objects.
Ways to Integrate BAM:

1.       Using Mediator Service with a composite architecture
2.       Using BPEL Composite service
3.       Using OSB with BAM JCA adapter


1.     Using Mediator Service with a composite architecture

    • Create a composite service and create an input web service (file adapter/WSDL partner link) for getting Input of the service.
    • In the Partner link panel create a BAM Adapter as per the guidelines.
    • In the Composite panel create a Mediator service and link it with both the WSDL Partner link (point a above) and with BAM adapter (point b)
    • Create a Transformation service as per the business requirements.


2.     Using BPEL Composite Service

    •  Create an Empty composite BPEL service and create an input web service (file adapter/WSDL partner link) for getting Input of the service.
    • In the Partner link panel create a BAM Adapter as per the guidelines.
    •  Now Drag and drop the Receive activity, Transform, Invoke and other required activities for processing.
    • Link all the related activities as per instructions and business logic.
    • Deploy and test the code.


3.     Using OSB and BAM Integration

Being OSB a different component and not a part of SOA Suite, we need to integrate it with BAM by using JCA, WSDL and Schema (XSD) files of BAM Adapter.

Below are some of the steps for working on the same process.
    • Create an Empty composite service in JDeveloper and drag and drop the BAM adapter. Configure the BAM adapter as done in above two types like in BPEL and Mediator.
    • In Eclipse IDE, create an OSB Project and Import the above created BAM adapter JCA, WSDL, and XSD files/folders.
    •  Generate a Business service with the use of JCA file.
    • Create a Proxy Message service with the provided schema file and use activities, transformation and routing service to link it with the above generated business service.
    • Deploy and test the code.


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...