Does UAA require the login-server to have scope uaa.user? - cloud-foundry

I've got a deployment where I'm running the UAA sample apps, along with the Java login-server. I've configured my UAA and login-server with a custom uaa.yml and login.yml, respectively. I've populated the uaa.yml based upon the details for the "login" client by looking at the contents of /uaa/uaa/src/main/webapp/WEB-INF/spring/oauth-clients.xml, as shown below:
<entry key="login">
<map>
<entry key="id" value="login" />
<entry key="secret" value="loginsecret" />
<entry key="scope" value="openid,uaa.user" />
<entry key="authorized-grant-types" value="client_credentials,authorization_code" />
<entry key="authorities" value="oauth.login" />
<entry key="autoapprove" value="true" />
</map>
</entry>
Configured this accordingly in my uaa.yml. This seemed to work fine, and I can log in and surf the sample app.
However, when I subsequently visited the /approvals page in the sample app, I got a javascript error in approvals.jsp which was apparently caused by the absence of any corresponding entry for scope.uaa.user in the messages.properties file.
[2013-03-20 18:05:52.787] login/login-server - ???? [http-8080-1] .... DEBUG --- DispatcherServlet: Could not complete request
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'scope.uaa.user' for locale 'en_US'.
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...
So, the question is -- is scope "uaa.user" really required by the login-server? And, if so, what should the entry in the messages.properties file say? I couldn't find any place that provided the agreed upon text description for uaa.user scope.
As a workaround, I've simply made up my own text for that scope in messages.properties, and the approvals page now renders OK.
Thanks,
John

Yes, the "uaa.user" is required by the login server. You can have any text string in the messages.properties file, which you will use in your application accordingly.
Let me know if that helps.
Thanks,
Hitesh

The login server can't predict what scopes are going to be available, as some may be custom to the application. The bug has been fixed here
https://github.com/cloudfoundry/login-server/commit/c39aa19db33c12a0d9740e2c0a53698b87889ebc
If no message is available to represent the scope, simply print out the name of the scope.

Related

how can I deeplink an app from Google Assistant?

I'm creating a dialogflow agent integrated with Google Assistant.
What I'd like to do is to open an app (my app) when a proper intent is matched. I've seen that actions like Youtube, Spotify etc. are able to do that, for example I can tell the Youtube action "search for cats video" and the Youtube app will open with a list of cats videos.
I tried to use the DeepLink class but I then noticed it's deprecated.
DeepLink class
Is there any way you can suggest me to do this?
Thanks in advance
I think you are looking for App Actions. Here are the steps you need to follow:
Find the right built-in intent. actions.intent.OPEN_APP_FEATURE should be the right one for you.
Create and update actions.xml. It should look like
<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a sample actions.xml -->
<actions>
<action intentName="actions.intent.OPEN_APP_FEATURE">
<!-- Use url from inventory match for deep link fulfillment -->
<fulfillment urlTemplate="{#url}" />
<!-- Define parameters with inventories here -->
<parameter name="feature">
<entity-set-reference entitySetId="featureParamEntitySet" />
</parameter>
</action>
<entity-set entitySetId="featureParamEntitySet">
<!-- Provide a URL per entity -->
<entity url="myapp://deeplink/one" name="featureParam_one" alternateName="#array/featureParam_one_synonyms" />
<entity url="myapp://deeplink/two" name="featureParam_two" alternateName="#array/featureParam_two_synonyms" />
</entity-set>
</actions>

Regarding <Results> Element/propery/Tag/Function in DataPower xslt

This may be somewhat naive but I am quite struck on the issue
There is a specific <result> element in DataPower and when calling through xslt we have somewhat following format(which I discovered in some forums)--
<results mode="require-all" multiple-outputs="true" transactional="true" retry-interval="100" asynchronous="false">
<url input="var://the_request_SOAP_Format"asynchronous="true">https://XXXXXXX</url>
now in this (url input) is the request which needs to be send and (https://XXXXXXX) is the specified backend where it needs to be sent
Now I have some authentication headers(httpHeaders) also which I need to send without which I will get Authorization error
<xsl:variable name="httpHeaders">
<header name="Content-Type">application/json</header>
<header name="Authorization">
<xsl:value-of select="concat('Bearer ',$some_sessionID)"/>
</header>
</xsl:variable>
Is this possible to add these 'httpHeaders' in the result mode element/Tab property
Thanks
I am not exactly sure what you are trying to achieve but adding http headers for the response (backside) you do with:
<dp:set-http-response-header name="'HeaderName'" value="$httpHeaders"/>
or
<dp:set-http-request-header name="'HeaderName'" value="$httpHeaders"/>
The <results> is the collection of data that the Processing Policy will output as Payload for the Request/Response and won't contain headers. You shouldn't try to alter the <results> object!
The "results-doc" method of calling backends is quite powerful, but I'm not sure from your question if you fully understand it. The url/#input attribute needs to be a DataPower context:
<url input="var://context/mycontext" ...
To associate headers with that context, you should do something like this for each header you need:
<dp:set-variable
name="'var://context/mycontext/_extension/header/Content-Type'"
value="'application/json'"/>
(This would be done in your XSLT code, separate from creating the "results" document, but before you use a Results Action to execute.)

Sitecore.Context.User.IsAuthenticated returns true for extranet\Anonymous user

I have Sitecore 6.6 installed. I wanted to add a new domain to Sitecore; Since my Sitecore instance is deployed in two servers with two Sitecore sites in each pointing to different web databases but same core, master and analytics databases, I couldn't do it using Sitecore Domain manager.So I thought of doing it manually by editting the App_Config\Security\domains.config in the server. The following was the domains.config that I had.
<?xml version="1.0" encoding="utf-8"?>
<domains xmlns:sc="Sitecore">
<domain name="sitecore" ensureAnonymousUser="false" />
<domain name="extranet" defaultProfileItemId="{AE4C4969-5B7E-4B4E-9042-B2D8701CE214}" />
<domain name="default" isDefault="true" />
<sc:templates>
<domain type="Sitecore.Security.Domains.Domain, Sitecore.Kernel">
<ensureAnonymousUser>true</ensureAnonymousUser>
<locallyManaged>false</locallyManaged>
</domain>
</sc:templates>
<domain name="Station" defaultProfileItemId="{F181ED3D-F342-46E6-B6F6-2A6A6173B513}" />
<domain name="Emailcampaign" />
</domains>
I added one more domain(MyDomain) at the end like below.
<?xml version="1.0" encoding="utf-8"?>
<domains xmlns:sc="Sitecore">
<domain name="sitecore" ensureAnonymousUser="false" />
<domain name="extranet" defaultProfileItemId="{AE4C4969-5B7E-4B4E-9042-B2D8701CE214}" />
<domain name="default" isDefault="true" />
<sc:templates>
<domain type="Sitecore.Security.Domains.Domain, Sitecore.Kernel">
<ensureAnonymousUser>true</ensureAnonymousUser>
<locallyManaged>false</locallyManaged>
</domain>
</sc:templates>
<domain name="Station" defaultProfileItemId="{F181ED3D-F342-46E6-B6F6-2A6A6173B513}" />
<domain name="Emailcampaign" />
<domain name="MyDomain" />
</domains>
As soon as I did that, Sitecore.Context.User.IsAuthenticated started returning true for extranet\Anonymous user(Non-logged in user) in the code.
Has anyone faced this issue before?
Please let me know where am I going wrong.
I also encounted this issue back when I was working with Sitecore 6.6, I'm not certain if its an issue in later versions. Essentially when you modified your domains.config with the param ensureAnonymousUser set to true the Anonymous User for that domain, in this case Extranet, was created in the database - it may not have been until you changed that setting.
In Sitecore all non-logged in users view the site as the user *domain*/anonymous. As Sitecore's membership is based on .NET Membership it determines that the User is logged in as its using that account.
Therefore I recommend completing an additional check with your Sitecore.Context.User.IsAuthenticated to check if the username of User's account is *domain of site*/anonymous, Sitecore.Context.User.Name, if it is return false.
EDIT
I have confirmed Sitecore.Context.User.IsAuthenticated returning true for *domain*\Anonymous user has been fixed in Sitecore 8. Therefore you can use it to determine if the User is logged in and not using the *domain*\anonymous account.
We finally resolved this issue! This was caused by a fix we added to solve an issue we had with Sitecore ECM. The issue was that Sitecore used to log out as soon as we clicked on the message preview. So we followed the steps given in the below thread to fix the issue.
https://stackoverflow.com/a/30836600/4165670
But we were not testing for Anonymous user like it is done in the thread. We never pushed this code into Content Delivery site and when
we created the new domain, This code got pushed into the Content Delivery site with some other code.
Since we are setting the current user as the Active user in the code, it started showing that extranet\Anonymous user as the current user.

Cas Ticket Issue in Jmeter

I have a web application which uses CAS Ticket for user authentication purpose which is different for every login. I recorded the script in JMeter. Also I correlated the pages by filling up the Regular Expression Extractor as follows:
Recorded script has url: https://foo.com/j_spring_cas_security_check?ticket=ST-3101-QDTyjbbHoOHvgPMdRBIg-cas.
After applying all above I ran the script but got status fail displaying https://foo.com/j_spring_cas_security_check?ticket=Ticket_Not_Found.
It would be very helpful if someone could tell me what did I miss in my script?
There is two ways for this,
if you have multiple username and password and you can use those with Jmeter,
you can use those to generate CAS ST(Service ticket).
Another:
default when CAS create ticket, it can be just used for one time.
you have to change values in ticketExpirationPolicies.xml of your cas server
to use same ticket multiple times.
default location is:
WEB_INF/spring-configuration/ticketExpirationPolicies.xml
change this to if you want 50 users to use same ticket
<!-- This argument is the time a ticket can exist before its considered expired. -->
<constructor-arg
index="1"
value="100000" />
</bean>
<bean id="grantingTicketExpirationPolicy" class="org.jasig.cas.ticket.support.TimeoutExpirationPolicy">
<!-- This argument is the time a ticket can exist before its considered expired. -->
<constructor-arg
index="0"
value="7200000" />
</bean>
Answer given by: VIVEK ADHIKARI
It seems that an error happened when fetching ticket value from url's parameter list. Maybe you can add a hidden field on your page and set its value from this parameter.
<input type="hidden" id="ticket_key" value="ST-3101-QDTyjbbHoOHvgPMdRBIg-cas" />
Then you can get it by Regular Extractor ticket_key=(.+)
Hope it helps.

Download specific version of a file from SharePoint using web services

Can someone provide a sample for downloading a specific version of a file from SharePoint using web services? Normally I would get the file with the Copy Web Service (.../_vti_bin/copy.asmx). But I don't really know how to specify a version.
Regards
Anton Kalcik
You can use the Versions web service to get which versions exist for a File
The GetVersions method will give you an xml like this:
<results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<list id="{26E516B0-8241-4B97-984D-000000000000}" />
<versioning enabled="1" />
<settings url="http://Server_Name/Site_Name/_layouts/
1033/LstSetng.aspx?
List={26E516B0-8241-4B97-984D-000000000000}" />
<result version="#4" url="http://Server_Name/Site_Name/
Shared Documents/File_Name.doc"
created="6/7/2003 5:55 PM" createdBy="DOMAIN\User" size="19968"
comments="" />
<result version="1" url="http://Server_Name/Site_Name/
_vti_history/1/Shared Documents/File_Name.doc"
created="6/7/2003 5:49 PM" createdBy="DOMAIN\User" size="19968"
comments="" />
.
.
.
</results>
You can then just use a HTTP GET request for the content of the "url" attribute of the "result" node for the right version
Here's the exact thing you want to do, with code:
Article