Apache Oltu Linkedin Integration example - spring-mvc

I am looking forward to developed the Spring MVC + Apache Oltu + Linkedin integration example. In this example, you need to send Client ID and Client Secret to access the private resource from the Linked in Site.
First Step - we need to create App in Linkedin, follow the steps: http://codeboxr.com/how-to-create-linkedin-app.html
Once App is created, you need to make sure you've given value for the redirect URL.
In the java code I used
setScope("r_network w_share r_basicprofile")
setState("987654321")
When I used the following code:
request= new OAuthBearerClientRequest("https://api.linkedin.com/v1/people/").buildQueryMessage();
I get the following errror. Could anyone please?
Could not access resource: 401 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
<status>401</status>
<timestamp>1429554559432</timestamp>
<request-id>QJWNLL5PWX</request-id>
<error-code>0</error-code>
<message>Unknown authentication scheme</message>
</error>
An important thing, I am getting correct details below, but seems accessing private resources:
{"access_token":"SQXZVmVM05AOzDB_DdBm5iaJkrEC8oK-FgE1m1snEZbMcKUODew9I0ZQ6NWc8JtGDxTtEd-yyPul0FtF3-hG4ah6LZ9P4oaSVuhhtybRFmjfsZcJwOs5Lm2IDUGQnjmq5EdT3PVR7Bocq31VBXg0JtkQdImab945oicO_w2j6CjlByp-bWw",
"expires_in":5108376}

It seems that you're successfully obtaining an OAuth 2.0 access token, you'll need to pass access_token in a query parameter when making API calls. That's how OAuth 2.0 authentication is handled (OAuth 1.0 required the access token to be in the header whereas OAuth 2.0 relies on a query parameter).
For example:
GET https://api.linkedin.com/v1/people/~?oauth2_access_token={your-access-token}
Please follow the link, if in case requires more details: https://developer-programs.linkedin.com/forum/unknown-authentication-scheme
If you send token along with the request to access protected resources, then you should be getting the following details.
The corrected code snippet:
request= new OAuthBearerClientRequest
("https://api.linkedin.com/v1/people/~?oauth2_access_token="+oAuthResponse.getAccessToken()).
buildQueryMessage();
In My Example, I am getting the following HTTP 200 OK response, just wanted to show you..
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
<id>LLIyXMKhNI</id>
<first-name>FirstName</first-name>
<last-name>LastName</last-name>
<headline>Spring Developer at Amazon</headline>
<site-standard-profile-request>
<url>https://www.linkedin.com/profile/view?id=154416688&authType=name&authToken=ipNL&trk=api*a4360331*s4423501*</url>
</site-standard-profile-request>
</person>
Hope this will be help you.

Related

Impossible to connect to SSO idp

I have a question. we have an app under symfony 5.4 which provide SAML connector via the OneloginSamlBundle bundle.
This app is installed is different customers.
Normally in majority of customers, when we connect to their idp, we have an answer like this :
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
...
<saml:Subject>
...
<saml:AttributeStatement>
<saml:Attribute Name="uid">
<saml:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">john_doe</saml:AttributeValue>
</saml:Attribute>
and we are able to map the attribute uid with the username in our application
The problem is we have with a customer which use AD FS is the response is like this :
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ... >
<Subject>
<NameID>john_doe</NameID>
...
</Subject>
And as in the bundle we have this code to retrive the attibute, it doesn't work
$entries = $this->_queryAssertion('/saml:AttributeStatement/saml:Attribute');
Do you know if AD FS could be configured to send a response with <saml:Attribute> ?
I find the solution :
customer added a claim rule (https://help.blackboard.com/Learn/Administrator/SaaS/Authentication/Implement_Authentication/SAML_Authentication_Provider_Type/SAML_Setup_Guide_for_ADFS) with the good Attribute Name and even the xml message is without the saml: prefix, it worked

GetReservation returning Viewership is restricted for the PNR

I'm currently using the sabre web service TravelItineraryReadLLSRQ (version 2.2.0) and I can successfully retrieve all on the PNR data. Now I'm trying to implement GetReservation but I'm getting the error below.
Not finding any further detail from the dev sabre portal - has anybody seen this and know what the 'fix' is?
"Viewership is restricted for the PNR, caused by [Viewership is restricted for the PNR (Unsupported security check), code: 700102, severity: MODERATE]"
<GetReservationRS xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Errors xmlns="http://webservices.sabre.com/pnrbuilder/v1_18">
<Error>
<Code>700102</Code>
<Message>Viewership is restricted for the PNR, caused by [Viewership is restricted for the PNR (Unsupported security check), code: 700102, severity: MODERATE]</Message>
<Severity>MODERATE</Severity>
</Error>
</Errors>
</GetReservationRS>
You may want to try using "Stateful" since "Stateless" is only intended for airline customers. You can use Stateful together with a locator or without it, makes no difference.
You may also may want to be aware that the service can be called with the Full, Default and Simple View Names. Only Simple will return more updated data which you can obtain by using the required subject areas in the payload. Full and Default will ignore the subject areas you use.

Get All Sales Order from Quick Book via QuickBook WebConnector using asp.net

I am using QuicBook Premier Edition UK , I have a company file open inside QuickBook. Build a sample WebService provided in samples and host in IIS. Added that application in WebConnector by using qwc file in samples.
I understood the callback methods required by WebConnector in soap service.
• authenticate
• clientVersion
• closeConnection
• connectionError
• getLastError
• receiveResponseXML
• sendRequestXML
I have tested web service by using WebConnector by using Update Selected button and it gives response 'OK' . But I am still confused how to get started with soap service , samples include 3 Xml request
CustomerQuery,
InvoiceQuery and
BillQuery .
How I test these request and see the response by using service . Can anyone explain the steps required to get me started with my own request of Get all Sales Order.
Thanks
Here is the screenshot
Here is the Last Output.
Version:
2.0.0.1
Message:
OK
Description:
Via closeConnection(): CloseConnection called to application.
Response received from application = OK
Explanation:
After calling authenticate(...), the Web Connector will call the sendRequestXML(...) method.
The sendRequestXML(...) method is essentially the Web Connector's way of saying "Hey, what do you want me to do?"
You should respond with a qbXML request telling QuickBooks/the Web Connector to do something. For example, if you are trying to get sales orders from QuickBooks, you could respond with a SalesOrderQuery qbXML request, something like this:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="8.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderQueryRq requestID="2">
</SalesOrderQueryRq>
</QBXMLMsgsRq>
</QBXML>
The Web Connector will then send that request to QuickBooks, it will be processed, and the Web Connector will then call your receiveResponseXML(...) method.
The receiveResponseXML(...) method is essentially the Web Connector's way of saying "Hey, you told me to do something, I did it, and here's all of the data I got back: ... (big blob of XML from QuickBooks here)".
TLDR:
Return a qbXML request from the sendRequestXML method. A qbXML response will be sent to you in the receiveResponseXML method.
More notes:
Bigger explanation of the Web Connector here: http://www.consolibyte.com/docs/index.php/QuickBooks_Web_Connector_Overview
Lots of qbXML examples here: http://www.consolibyte.com/docs/index.php/Example_qbXML_Requests
Hundreds of pages of documentation in the QuickBooks SDK: https://developer.intuit.com/docs/0250_qb/0020_get_set_up/sdk_downloads

Error During PingFederate Agentless Sequence

Some of our users are encountering the following error page during the sequence of redirects after authenticating at their IdP.
"Unexpected exception occurred in Response Handling: null"
Partner: ...
Target: ...
This is what I believe is the corresponding info from the the server log.
2015-07-16 07:48:53,458 DEBUG [com.pingidentity.jgroups.MuxInvocationHandler] invocation of saveState on InterReqStateMgmtMapImpl state map size:215 attributes map size4 w/args: [ZkyN3LwNSjurZyfIewu1Kgjbgl7HrB, State(1437050933419){
inMsgCtx=null
outMsgCtx=OutMessageContext
XML: <samlp:AuthnRequest Version="2.0" ID="E6_0yldGrt0iqNKfUpArog6DG8G" IssueInstant="2015-07-16T12:48:53.419Z" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">#issuer%</saml:Issuer>
<samlp:NameIDPolicy AllowCreate="true"/>
</samlp:AuthnRequest>
entityId: <Id> (IDP)
Binding: urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect
relayState: ZkyN3LwNSjurZyfIewu1Kgjbgl7HrB
Endpoint: <endpoint>
SignaturePolicy: DO_NOT_SIGN
parameters=null}] returned null
Is there an obvious place to look for more details? This happens for around 10% of our users and seems to follow them from device to device.
I figured out what the issue was. We are using account linking using the SAML Subject from the IdP. It turned out that a number of accounts at the IdP didn't have the LDAP attribute mapped to the NameID populated. So we were receiving SAML assertions without any data in the Subject.
Understanding where to look is the key. The audit.log file shows a general "failure". Then you look up corresponding activity details in the server.log file. Then you examine the corresponding SAML assertion in the log to determine what the problem was. The difficult part is noticing omissions in the data. That's harder for the eye/brain to catch imho.
It would be useful if we had an option for directing users to a custom page rather than a Ping-specific error page when this occurs.

Payment Gateway Integration error solving

I have a windows application that requires Payment Gateway Integration.
All these stuff i have done.
The process includes the following...
-Creating Xml Request header
-Encoding it as Url
-send the url encoded data to a Rest API with link being provided in the documentation.
-The test server performs the transaction and sends response back to the application.
What I have done to achieve these functionality...
1) I have used 'HttpWebRequest' class to create request to the URL : I am not going to share it since it security and confidential.
2) I have generated xml header and send it as url encoded.
3) The Server is even responses back to the application. but with Status not success
I am going to post the request formate and response formate.
<?xml version="1.0" encoding="UTF-8"?>
<payment xmlns="http://www.elastic-payments.com/schema/payment">
<merchant-account-id>!#-merchant-account-id-#!</merchant-account-id>
<request-id>!#-request-id-#!</request-id>
<transaction-type>purchase</transaction-type>
<requested-amount currency="AUD">!#-requested-amount-#!</requested-amount>
<account-holder>
<first-name>!#-first-name-#!</first-name>
<last-name>!#-last-name-#!</last-name>
<email>!#-email-#!</email>
<phone>!#-phone-#!</phone>
<address>
<street1>!#-street1-#!</street1>
<street2>!#-street2-#!</street2>
<city>!#-city-#!</city>
<state>!#-state-#!</state>
<country>!#-country-#!</country>
<postal-code>!#-postal-code-#!</postal-code>
</address>
</account-holder>
<card>
<account-number>!#-account-number-#!</account-number>
<expiration-month>!#-expiration-month-#!</expiration-month>
<expiration-year>!#-expiration-year-#!</expiration-year>
<card-type>!#-card-type-#!</card-type>
<card-security-code>!#-card-security-code-#!</card-security-code>
</card>
<notifications>
<notification url="!#-notification-url-#!" transaction-state="failed" />
<notification url="!#-notification-mail-#!" />
</notifications>
<custom-fields>
<custom-field field-name="order no" field-value="!#-order no-#!" />
</custom-fields>
<ip-address>!#-ip-address-#!</ip-address>
</payment>
The following is the response coming back from the server.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<payment xmlns="http://www.elastic-payments.com/schema/payment" self="http://sandbox-engine.thesolution.com/engine/rest/merchants/null/payments/null">
<merchant-account-id ref="http://sandbox-engine.thesolution.com/engine/rest/config/merchants/null"/>
<transaction-state>failed</transaction-state>
<completion-time-stamp>2012-11-28T08:19:31.024Z</completion-time-stamp>
<statuses>
<status code="400.1018" description="The same Request Id for the Merchant Account is being tried a second time. Please use another Request Id. " severity="error"/>
<status code="400.1009" description="The Transaction Type is invalid. Please check your input and try again." severity="error"/>
</statuses>
<requested-amount/>
<api-id>elastic-api</api-id>
</payment>
I have cross checked twice with the request header,Each time i do have unique Request id which is 'hiren-'+GUID+DATETIMEWITHTIME
I even have cross checked with the documentation of the gateway for the transaction-type and it's valid but even then it's giving the same error.
To encode url i have used the following code
string sendString = "param=" + HttpUtility.UrlEncode(xmlData);
I'm thinking that the above code may be having the error but it's giving reply back...
so need help to solve the problem.
Please don't ask for the document file but you can ask for extra information.

Resources