Problem using OAuth2 Bearer Token in Azure B2C REST Call - rest

I am calling a REST API with a bearer token from my self-asserted-login technical profile. I have placed the call in the validation profiles as below -
<TechnicalProfile Id="SelfAsserted-LocalAccountSignin-Username">
<DisplayName>Local Account Signin</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="SignUpTarget">SignUpWithLogonUsernameExchange</Item>
<Item Key="setting.operatingMode">Username</Item>
<Item Key="setting.showSignupLink">False</Item>
<Item Key="setting.forgotPasswordLinkLocation">none</Item>
<Item Key="ContentDefinitionReferenceId">api.signuporsignin</Item>
</Metadata>
<IncludeInSso>false</IncludeInSso>
<InputClaims>
<InputClaim ClaimTypeReferenceId="signInName" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="signInName" Required="true" />
<OutputClaim ClaimTypeReferenceId="password" Required="true" />
<OutputClaim ClaimTypeReferenceId="objectId" />
<OutputClaim ClaimTypeReferenceId="authenticationSource" />
</OutputClaims>
<ValidationTechnicalProfiles>
**<ValidationTechnicalProfile ReferenceId="SecureREST-AccessToken" ContinueOnError="false"/>
<ValidationTechnicalProfile ReferenceId="REST-UserMigration-LocalAccount-SignIn" ContinueOnError="true" />
<ValidationTechnicalProfile ReferenceId="login-NonInteractive"/>**
</ValidationTechnicalProfiles>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>
I can trace that the REST call is being made successfully with the bearer token in the header. However, the "login-NonInteractive" is not working. It is giving error "invalid username or password". However, if I remove below two steps the "login-NonInteractive" works fine.
It seems like there is a side effect from OAuth2 enabled REST call and "login-NonInteractive". They should be completely unrelated but the strange behavior halting my production.
**<ValidationTechnicalProfile ReferenceId="SecureREST-AccessToken" ContinueOnError="false"/>
<ValidationTechnicalProfile ReferenceId="REST-UserMigration-LocalAccount-SignIn" ContinueOnError="true" />**
Any help would be very much appreciated.

Related

Spring security - GWT redirect after Authentication

I have a GWT application that I am trying to login using spring security. Currently, after a successful login, I am redirected back to the Login page. I am guessing this is because of my spring configuration and my lack of spring security knowledge.
In my spring-security.xml I define my intercepts like so:
<security:http auto-config="true">
<security:intercept-url pattern="/login" access="permitAll" />
<security:intercept-url pattern="/**" access="isAuthenticated()" />
</security:http>
I am guessing that the issue is on the access=isAuthenticated() but I am not sure. I want it to redirect to the gwt page/app which will handle the view based on the role returned. I made a very simple gwt app with this method and it worked.
I am using the Spring generated login page and not a JSP.
spring-security.xml
<?xml version="1.0" encoding="UTF-8"?>
<b:beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:b="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
<!-- This is where we configure Spring-Security -->
<security:http auto-config="true">
<security:intercept-url pattern="/login" access="permitAll" />
<security:intercept-url pattern="/**" access="isAuthenticated()" />
</security:http>
<b:bean id="graplAuthentication" class="com.foo.rim.security.GraplAuthentication"/>
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="graplAuthentication" />
</security:authentication-manager>
</b:beans>
This turned out to be two things.
1) I needed to add the user-expressions="true" so it would pick up the access=
<security:http auto-config="true" use-expressions="true">
2) I had a custom user Authentication class and forgot to set the the Authenticated boolean to true. Both of these got it working correctly.

Qlikview REST connector pagination settings for OData source xml

I can't seem to get the pagination settings right for the Qlik REST connector getting data from an OData-source. It's publicly available Dutch statistics (CBS).
An example is: https://opendata.cbs.nl/ODataFeed/odata/37259ned/TypedDataSet
First bit of the response:
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="http://opendata.cbs.nl/ODataFeed/OData/37259ned" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
<id>https://opendata.cbs.nl/ODataFeed/OData/37259ned/TypedDataSet</id>
<title type="text">TypedDataSet</title>
<updated>2018-06-25T02:00:00+02:00</updated>
<link rel="self" title="TypedDataSet" href="https://opendata.cbs.nl/ODataFeed/OData/37259ned/TypedDataSet" />
<entry>
<id>https://opendata.cbs.nl/ODataFeed/OData/37259ned/TypedDataSet(0)</id>
<category term="Cbs.OData.TData" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="self" href="https://opendata.cbs.nl/ODataFeed/OData/37259ned/TypedDataSet(0)" />
<title />
<updated>2018-06-25T02:00:00+02:00</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:ID m:type="Edm.Int32">0</d:ID>
<d:Geslacht>T001038</d:Geslacht>
<d:RegioS xml:space="preserve">NL01 </d:RegioS>
<d:Perioden>1960JJ00</d:Perioden>
<d:BevolkingOp1Januari_1 m:type="Edm.Double">11417254</d:BevolkingOp1Januari_1>
<d:LevendGeborenKinderen_2 m:type="Edm.Double">238789</d:LevendGeborenKinderen_2>
<d:LevendGeborenKinderenRelatief_3 m:type="Edm.Double">20.8</d:LevendGeborenKinderenRelatief_3>
<d:Overledenen_4 m:type="Edm.Double">87486</d:Overledenen_4>
<d:OverledenenRelatief_5 m:type="Edm.Double">7.6</d:OverledenenRelatief_5>
<d:Geboorteoverschot_6 m:type="Edm.Double">151303</d:Geboorteoverschot_6>
<d:TotaalVestiging_7 m:type="Edm.Double">551116</d:TotaalVestiging_7>
<d:TotaalVestigingRelatief_8 m:type="Edm.Double">48</d:TotaalVestigingRelatief_8>
<d:Immigratie_9 m:type="Edm.Double">45407</d:Immigratie_9>
<d:UitAndereGemeente_10 m:type="Edm.Double">505709</d:UitAndereGemeente_10>
<d:TotaalVertrekInclusiefCorrecties_11 m:null="true" />
<d:TotaalVertrekInclusiefCoRelatief_12 m:null="true" />
<d:TotaalVertrekExclusiefCorrecties_13 m:type="Edm.Double">564209</d:TotaalVertrekExclusiefCorrecties_13>
<d:TotaalVertrekExclusiefCoRelatief_14 m:type="Edm.Double">49.1</d:TotaalVertrekExclusiefCoRelatief_14>
<d:EmigratieInclusiefAdministratieveC_15 m:null="true" />
<d:EmigratieExclusiefAdministratieveC_16 m:type="Edm.Double">58226</d:EmigratieExclusiefAdministratieveC_16>
<d:NaarAndereGemeente_17 m:type="Edm.Double">505983</d:NaarAndereGemeente_17>
<d:VestigingsoverschotInclusiefCorrecties_18 m:null="true" />
<d:VestigingsoverschotExclusiefCorrecties_19 m:type="Edm.Double">-13093</d:VestigingsoverschotExclusiefCorrecties_19>
<d:TotaalSaldoCorrecties_20 m:type="Edm.Double">544</d:TotaalSaldoCorrecties_20>
<d:SaldoAdministratieveCorrecties_21 m:null="true" />
<d:SaldoOverigeCorrecties_22 m:null="true" />
<d:TotaleGroei_23 m:type="Edm.Double">138754</d:TotaleGroei_23>
<d:TotaleGroeiRelatief_24 m:type="Edm.Double">12.2</d:TotaleGroeiRelatief_24>
<d:BevolkingOp31December_25 m:type="Edm.Double">11556008</d:BevolkingOp31December_25>
</m:properties>
</content>
</entry>
The source gives a maximum of 10000 records per page. I need to get the data on the following page(s) as well.
The last few lines look like this:
</entry>
<link rel="next" href="https://opendata.cbs.nl/ODataFeed/odata/37259ned/TypedDataSet?$skip=10000" />
</feed>
I've tried the sollution in this thread: Qlikview REST connector pagination namespaced XML
However this gives me an unlimited number of records. The data-load does not stop at the last record.
Pagination settings used:
Pagination Type: Next URL
Next URL field path: feed/link/attr:href
Can anybody help me with the settings?

Sharepoint 2010 REST List Service is missing person fields?

When accessing a Sharepoint 2010 list via the REST service endpoint using listdata.svc:
.../_vti_bin/listdata.svc/ExpenseBudgetSubmissionRequests
The response is missing person/user fields that are defined in the list:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base=".../_vti_bin/listdata.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">ExpenseBudgetSubmissionRequests</title>
<id>.../_vti_bin/listdata.svc/ExpenseBudgetSubmissionRequests/</id>
<updated>2017-08-17T08:03:15Z</updated>
<link rel="self" title="ExpenseBudgetSubmissionRequests" href="ExpenseBudgetSubmissionRequests" />
<entry m:etag="W/"1"">
<id>.../_vti_bin/listdata.svc/ExpenseBudgetSubmissionRequests(1)</id>
<title type="text">Department1</title>
<updated>2017-08-16T11:20:29+01:00</updated>
<author>
<name />
</author>
<link rel="edit" title="ExpenseBudgetSubmissionRequestsItem" href="ExpenseBudgetSubmissionRequests(1)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Status" type="application/atom+xml;type=entry" title="Status" href="ExpenseBudgetSubmissionRequests(1)/Status" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" type="application/atom+xml;type=entry" title="CreatedBy" href="ExpenseBudgetSubmissionRequests(1)/CreatedBy" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" type="application/atom+xml;type=entry" title="ModifiedBy" href="ExpenseBudgetSubmissionRequests(1)/ModifiedBy" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Attachments" type="application/atom+xml;type=feed" title="Attachments" href="ExpenseBudgetSubmissionRequests(1)/Attachments" />
<category term="Microsoft.SharePoint.DataService.ExpenseBudgetSubmissionRequestsItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:ContentTypeID>0x0100F434AF171BE4B04F8C760EB990D765EF</d:ContentTypeID>
<d:Department>Department1</d:Department>
<d:CostCentre>CostCentre1</d:CostCentre>
<d:FinancialYear m:type="Edm.Double">2017</d:FinancialYear>
<d:StatusValue>Unsubmitted</d:StatusValue>
<d:Id m:type="Edm.Int32">1</d:Id>
<d:ContentType>Item</d:ContentType>
<d:Modified m:type="Edm.DateTime">2017-08-16T11:20:29</d:Modified>
<d:Created m:type="Edm.DateTime">2017-08-16T11:20:29</d:Created>
<d:CreatedById m:type="Edm.Int32">2</d:CreatedById>
<d:ModifiedById m:type="Edm.Int32">2</d:ModifiedById>
<d:Owshiddenversion m:type="Edm.Int32">1</d:Owshiddenversion>
<d:Version>1.0</d:Version>
<d:Path>.../Lists/Expense Budget Submission Requests</d:Path>
</m:properties>
</content>
</entry>
</feed>
Attempted to specify person fields through the $select and $exapnd parameters but with no success. How do you access the person fields?
Credit to this blog entry:
https://thesharepointdive.wordpress.com/2014/09/17/user-field-does-not-appear-sharepoint-2010-rest-services/
The List attribute is missing from the Schema.xml, however without the right access I cannot seem to edit the Schema xml file directly.
Solution: In the list settings set the person field to choose from a user group. You can always set it back to All users afterwards but this action creates the List attribute against the field in the list schema.xml.
User fields are now present in the REST response.

Failed to publish application to Azure Service Fabric cluster

I am trying to publish an application to Azure Service Fabric cluster. The moment I click publish from VS2015, I get those following errors:
"An error occurred reading the file xxx\publishprofiles\cloud.xml. There is an error in XML document (7, 6)"
"Object reference not set to an instance of an object"
This is the content of the Cloud.xml file:
<?xml version="1.0" encoding="utf-8"?>
<PublishProfile xmlns="http://schemas.microsoft.com/2015/05/fabrictools">
<ClusterConnectionParameters ConnectionEndpoint=... />
<ApplicationParameterFile Path="xxx\ApplicationParameters\Cloud.xml" />
<UpgradeDeployment Mode="Monitored" Enabled="true">
<Parameters FailureAction="Rollback" Force="True" />
<Parameters UpgradeReplicaSetCheckTimeoutSec="1" Force="True" />
</UpgradeDeployment>
</PublishProfile>
It seems that I can have only one of the parameters (FailureAction OR UpgradeReplicaSetCheckTimeoutSec) for VS2015 to successfully load the file.
I wonder if anyone has some insights into this issue?
There can only be one Parameters element. Combine all your parameters into just one Parameters element.
Example:
<?xml version="1.0" encoding="utf-8"?>
<PublishProfile xmlns="http://schemas.microsoft.com/2015/05/fabrictools">
<ClusterConnectionParameters ConnectionEndpoint=... />
<ApplicationParameterFile Path="xxx\ApplicationParameters\Cloud.xml" />
<UpgradeDeployment Mode="Monitored" Enabled="true">
<Parameters FailureAction="Rollback" Force="True" UpgradeReplicaSetCheckTimeoutSec="1" />
</UpgradeDeployment>
</PublishProfile>

Mule Set JSESSIONID from first into 2nd REST request or how to put the cookie through

for my Thesis I'm integrating Bonita BPM into a Mule SOA.
To start a new case or process-instance in Bonita I have to call the Bonita REST. First I have to authenticate with that Bonita REST. And here starts my problem.
The authentication works like "You have to call the loginservice and put the responding cookie in all future request".
How could this be done inside a mule flow ? Some articles told me that copy-properties propertyName="JSESSIONID" should do that. But this does not work.
Does anybody have a idea ?
Further heres my flow and the related print messages:
PRINT1 : CopyPropertiesTransformer: Property value for is null, no property will be copied
PRINT 2 : LoggerMessageProcessor: {Set-Cookie=JSESSIONID=F60114E3ECB450A62171E3D63EAC3E4D; Path=/bonita/; HttpOnly}
PRINT 3 : Response code 401 mapped as failure. Message payload is of type: BufferInputStream
<http:request-config name="bos" host="localhost"
port="8080" basePath="/bonita" doc:name="bos-connection" />
<flow name="sendOrderFlow">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/" doc:name="HTTP" />
<http:request config-ref="bos" path="loginservice"
method="GET" followRedirects="false" doc:name="bos-login">
<http:request-builder>
<http:query-param paramName="username" value="walter.bates" />
<http:query-param paramName="password" value="bpm" />
</http:request-builder>
</http:request>
<copy-properties propertyName="JSESSIONID" /> <!-- PRINT 1 HERE -->
<logger message="#[headers:INBOUND:Set-Cookie]" level="INFO" /> <!-- PRINT 2 HERE -->
<http:request config-ref="bos"
path="API/bpm/process" method="GET" followRedirects="false" doc:name="bos-listAvailableProcesses">
<http:request-builder>
<http:query-param paramName="p" value="0" />
</http:request-builder>
</http:request>
Additionally to JSESSIONID you also need to include X-Bonita-API-Token in HTTP header. The value of this header is provide as a cookie sent with the answer to the authentication (i.e. the call to loginservice).