I want to deploy my rest API to wso2 ESB. I am adding my API URL to the wso2 ESB swagger URL with the header authorization key. But I am not to add a header in the wso2 swagger URL. Here I am sending my code syntax,
Could anybody fix my problem?
<api xmlns="http://ws.apache.org/ns/synapse" name="meter" context="/Ls" hostname="localhost" version="1.0.0.0" version-type="url" publishSwagger="file:http://172.27.100.27:8000>
<resource methods="GET"/>
</api>
Related
How can I assign an openAM user to the Activiti processes.
I have an openAM that is running on apache and side by side I have an spring application Activiti Processes.
how can i add a user through openAM to my BPMn process.
1 i have integrated my openAM with activiti process application.
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:activiti="http://activiti.org/bpmn"
id="sample-diagram"
targetNamespace="http://bpmn.io/schema/bpmn"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="sampleproc-e9b76ff9-6f70-42c9-8dee-f6116c533a6d" name="Sample Process" isExecutable="true">
<bpmn2:documentation />
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_0qdq7ff</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:userTask id="UserTask_0b6cp1l" name="User Task 1" activiti:assignee="demo">
<bpmn2:incoming>SequenceFlow_0qdq7ff</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1sc9dgy</bpmn2:outgoing>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_0qdq7ff" sourceRef="StartEvent_1" targetRef="UserTask_0b6cp1l" />
<bpmn2:serviceTask id="ServiceTask_1wg38me" name="Service Task 1" implementation="serviceTask1Impl">
<bpmn2:incoming>SequenceFlow_1sc9dgy</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0t37jio</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_1sc9dgy" sourceRef="UserTask_0b6cp1l" targetRef="ServiceTask_1wg38me" />
<bpmn2:endEvent id="EndEvent_0irytw8">
<bpmn2:incoming>SequenceFlow_0t37jio</bpmn2:incoming>
</bpmn2:endEvent>
you may have several options, based on your deployment.
If you use 'domain cookies' you could just use a simple servlet filter based on https://backstage.forgerock.com/docs/openam/13.5/apidocs/com/iplanet/sso/SSOTokenManager.html
You could do the same if OpenAM and your web app are accessed via the same FQDN (e.g. using an HTTP reverse-proxy)
If OpenAM and the FQDN used to access the Spring app do not share a cookie domain, you could either use an OpenAM Policy Agent that solves this for you or you could use an internet standards based approach by leveraging SAML or OIDC.
Spring Security has modules for both or you apply a module in an HTTP reverse-proxy server (e.g. Apache http server, mod_auth_mellon for SAML or mod_auth_oidc for OIDC).
We have developed mule projects using AnyPoint Studio 6.1.0. We deploy these in cloudhub and access them using https urls. If it is POST method we pass JSON data and get the response. Here we are trying to provide security to the deployed app URLs so that end users must provide username and password to access these URLs.
Can anyone of you help us to implement security to Mule projects deployed to Cloudhub.For example, basic authentication security mechanism or any other ?
Mule uses Spring Security for authentication.
Detailed user guide: https://docs.mulesoft.com/mule-user-guide/v/3.8/configuring-the-spring-security-manager
This has an example of the http-security-filter that you need to put in the HTTP inbound endpoint.
Hope this helps
you need to use security manager to create a basic auth,Use the below spring beans in your mule configuration file.
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="user" password="password" authorities="ROLE_ADMIN" />
<ss:user name="anon" password="anon" authorities="ROLE_ANON" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<mule-ss:security-manager>
<mule-ss:delegate-security-provider name="memory-provider" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
And after your http componenet add the basic auth
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<http:basic-security-filter realm="mule-realm"/>
I can't seem to find a simple article on how to publish an existing restAPI through WSO2 ESB as proxy.
I have an existing API which responds with either Json or XML output based on content-type on the header. I would like to publish this api through the WSO2 ESB as proxy. I don't think WSO2 Application server is needed in this case, as the rest api is running on its own app server.
API:
http://somehost.com:8001/api/BusinessApi/GetContentTypes
Response:
[{"contentTypeID":1,"name":"Movies","isTop":true,"subLevels":1,"contentTypeIdBase":1},{"contentTypeID":2,"name":"TV Show","isTop":true,"subLevels":3,"contentTypeIdBase":4},{"contentTypeID":3,"name":"TV Season","isTop":false,"subLevels":2,"contentTypeIdBase":4},{"contentTypeID":4,"name":"TV Episode","isTop":false,"subLevels":1,"contentTypeIdBase":4},{"contentTypeID":5,"name":"Music Album","isTop":true,"subLevels":2,"contentTypeIdBase":6},{"contentTypeID":6,"name":"Music Track","isTop":false,"subLevels":1,"contentTypeIdBase":6},{"contentTypeID":7,"name":"Music Video","isTop":false,"subLevels":1,"contentTypeIdBase":7},{"contentTypeID":8,"name":"Book Set","isTop":false,"subLevels":1,"contentTypeIdBase":8},{"contentTypeID":9,"name":"Books","isTop":true,"subLevels":1,"contentTypeIdBase":9}]
The objective is to publish the api via WSO2 ESB and try to achieve the below actions:
Logging the API calls
Messaging/ forking calls based on a criteria
Centralize all API calls authentication model
Is it possible to just run ESB server to achieve this function?
Thanks in Advance!!
Setting up a proxy API, this can only be done via
adding API option under main->service-bus->APIs
Give the API a custom name, which is the identity on WSO2 ESB.
Give the context which is your custom resource.
go to the source view and add the below source
Begin of snippet
<api xmlns="http://ws.apache.org/ns/synapse" name="GetC" context="/api1">
<resource methods="GET" url-mapping="/">
<inSequence>
<log/>
<send>
<endpoint>
<address uri="http://somehost.com:8001/api/businessApi/GetContentTypes"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log/>
<send/>
</outSequence>
</resource>
</api>
End of snippet
You should now be to access the api via ESB proxy url
With your approach, you have created an api in ESB, which passes the request to your backend api. During this you expect to log every api call and control authentication too. I didn't understand the forking requirement.
Have you tried WSO2 API Manager? It will allow you to make your api a managed api. i.e. You will be able to control access to your api via oauth tokens. You can log the api calls too (although its not a good thing to log every call due to performance reasons).
If you integrate it with WSO2 DAS, you will be able to see some useful stats too. This is the API Manager documentation.
https://docs.wso2.com/display/AM1100/WSO2+API+Manager+Documentation
I'm new to Mule and am trying to setup a web server [in Mule] to "replace" an existing Java server - which simply proxies for a SOAP web service.
So:
Web client (js/html) requests a static resource
Mule Server must return the static resource
or
Web client uses Jquery Ajax (json) request with path starting with "api/"
Mule Server must forward the request to the Java server (to use the old API)
or
Web client uses Jquery Ajax request with path starting with "sapi/"
Mule Server must translate the request to XML and call the SOAP server (for new api calls)
I'm struggling to find a good starting point:
I've played with Ajax connectors (and end-points) and can get the static content served - but not sure where to go with the api calls (don't want to force the client app to use mule.js)
I've played with HTTP end points, and I can't get the static content served (implicit Content-Type issue)
Any help will be appreciated...
Use http:static-resource-handler to serve your static content: it should take care of the content types for you. See for more info: http://www.mulesoft.org/documentation/display/current/HTTP+Transport+Reference#HTTPTransportReference-ServingStaticContent%28sinceMule3.2%29
Forget about the Ajax connector, all you need is the HTTP connector. Bind one HTTP endpoint on api and the other on sapi.
When forwarding the request, be sure to propagate headers and, potentially, path extension after api/. See the example below to see how this is typically done.
<flow name="rawProxy">
<http:inbound-endpoint
address="http://localhost:${http.port}/rest-proxies/raw"
exchange-pattern="request-response" />
<copy-properties propertyName="*" />
<http:outbound-endpoint address="http://localhost:${http.port}/rest/#[message.inboundProperties['http.relative.path']]?#[message.inboundProperties['http.query.string']]"
exchange-pattern="request-response" />
<response>
<copy-properties propertyName="*" />
</response>
</flow>
If the SOAP API you're calling as a WSDL then generate a client for it and instead of transforming to XML, transform to the request object it expects.
An error occurred while trying to make a request to URI:
'http://localhost:8732/Design_Time_Addresses/WCF/Service1/'. This
could be due to attempting to
access a service in a cross-domain way without a proper cross-domain
policy in place, or a
policy that is unsuitable for SOAP services. You may need to contact
the owner of the service
to publish a cross-domain policy file and to ensure it allows
SOAP-related HTTP headers to be
sent. This error may also be caused by using internal types in the web
service proxy without
using the InternalsVisibleToAttribute attribute. Please see the inner
exception for more
details.
the error appears when result returned from the wcf
I consumed this wcf via console, website, win forms and it works properly
I use 2 xml files in the WCF library :
clientaccesspolicy.xml
crossdomain.xml
It used to make my brain hurt too.
I figured out for my use I needed this file:
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
named clientaccesspolicy.xml
The trick is that is has to be at the root of your web server. That being said you need to be able to browse the file. In your case located at:
http://localhost:8732/clientaccesspolicy.xml
If you cannot see the file silverlight will always complain and boy does it complain whenever it can!
I should point out that my policy file is not restrictive, so use it wisely.
Oh, that problem. Besides the crossdomain, you cannot run the debugger from VS2010 which is what i'm gather from that localhost URL. Try publishing silverlight app on the domain or server that your WCF is on. For example, if your web service is on http://10.xx.xx.xx/sites/myWCF, publish your silverlight app on http://10.xx.xx.xx/sites/MySilverlightApp. You're debugger is going to run as http://localhost:somePort which is definitely going to give you problems even with a cross-domain policy file. Apart from that, ensure that you config file for your web.service is correct. Ensure all the interfaces have endpoint bindings and there is a host on the main service location(sounds obvious, but is a common error).