<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: How do I access a Java servlet from a UI5 application in Cloud Foundry? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484424#M4677482</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;thanks for describing your scenario more in detail and I agree: it makes sense
to have a separate utility-app that can be reused. It was just a question,
there should be no reason why it shouldn’t work.&lt;/P&gt;&lt;P&gt;Today, I’ve set up a little scenario, to reproduce your scenario – and for me
it works, even the scope is sent….&lt;BR /&gt;I can send you this mini-project, so you can check and compare.&lt;/P&gt;&lt;P&gt;Can you try calling the approuter-route
directly, not via webapp, but directly the route-URL?&lt;/P&gt;&lt;P&gt;One more
info, just in case:&lt;BR /&gt;In
approuter config, xs-app.json file, if you don’t specify the properties authenticationMethod
and authenticationType, then the default is always "xsuaa".&lt;BR /&gt;If you don’t
need authentication, you have to set it to "none".&lt;/P&gt;</description>
    <pubDate>Wed, 23 Feb 2022 16:54:09 GMT</pubDate>
    <dc:creator>CarlosRoggan</dc:creator>
    <dc:date>2022-02-23T16:54:09Z</dc:date>
    <item>
      <title>How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaq-p/12484414</link>
      <description>&lt;P&gt;I have a UI5 application in Neo that currently calls a Java servlet (named UserInfo.java) which uses a remote function call to return an encrypted user token. I have followed the steps in &lt;A href="https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/bfcb54ca058f4b1dafd26e438ff1e2f4.html" target="_blank"&gt;Invoke ABAP Function Modules in On-Premise ABAP Systems&lt;/A&gt; to re-create the Java servlet in Cloud Foundry and it appears to be running. When I try to run the UI5 application in Cloud Foundry, however, I receive a 404 (Not Found) error on the Java application. We are using the following jquery statement to call the servlet: &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;jQuery.sap.syncGet('/userinfo/UserInfo').data&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; Here is the entry for the servlet in the xs-app.json of the UI5 application:&lt;/P&gt;
  &lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/2012911-xs-app-entry.jpg" data-attachment="2012911"&gt;xs-app-entry.jpg&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;Here is how the servlet entry looks in the neo-app.json of the original UI5 application running in Neo:&lt;/P&gt;
  &lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/2012912-neo-app-entry.jpg" data-attachment="2012912"&gt;neo-app-entry.jpg&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;What am I missing?&lt;/P&gt;
  &lt;P&gt;UPDATE: It appears the only way to access a servlet from UI5 in CF is by creating a standalone app router in my project, so I let BAS generate a brand new multi-target application, added a standalone app router module and a UI5 module. By following some other blogs, I converted the java servlet to a maven project (I guess this was required??), created and bound its necessary services in the CF cockpit, made the necessary adjustments to the xs-app.json, the mta.yaml, and the destinations.json files in the multi-target app, and added a small Text control to the UI5 view (this UI5 app is completely bare-bones and not the original app, by the way) to display the results of calling the servlet. So, I got a 401 error on the servlet, looked through the log of my servlet and found the "Request could not be authenticated . . . jwt token with audience . . . is not issued" error, which led me to this blog - &lt;A rel="nofollow" href="https://blogs.sap.com/2020/09/03/outdated-sap_jwt_trust_acl"&gt;https://blogs.sap.com/2020/09/03/outdated-sap_jwt_trust_acl&lt;/A&gt; .&lt;/P&gt;
  &lt;P&gt;I have created a xs-security.json file in both the multi target app and the java servlet with the scope grant and so forth. Unfortunately, I am still receiving the same 401 error. Please provide guidance when you have a moment. Attached are a screenshot of the error from the log, the xs-security file from the multi target app (mtatest) and the xs-security file from the java servlet (userinfo).&lt;/P&gt;
  &lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/2023713-401error.jpg" data-attachment="2023713"&gt;401error.jpg&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;xs-security.json of mtatest:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;{
  "xsappname": "mtatest",
  "tenant-mode": "dedicated",
  "description": "Security profile of called application",
  "authorities":["$XSAPPNAME(application,userinfo).Display"],
  "scopes": [
    {
      "name": "uaa.user",
      "description": "UAA"
    }
  ],
  "role-templates": [
    {
      "name": "Token_Exchange",
      "description": "UAA",
      "scope-references": [
        "uaa.user"
      ]
    }
  ]
}&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;P&gt; xs-security.json of userinfo:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;code&amp;gt;{
  "xsappname": "userinfo",
  "tenant-mode": "shared",
  "scopes": [
    {
      "name": "$XSAPPNAME.Display",
      "description": "display",
      "grant-as-authority-to-apps" : [ "$XSAPPNAME(application, mtatest)"]
    }
  ],
  "role-templates": [
    {
      "name": "Viewer",
      "description": "Required to view things in your solution",
      "scope-references"     : [
        "$XSAPPNAME.Display"
      ]
    }
  ]
}&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Jan 2022 14:55:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaq-p/12484414</guid>
      <dc:creator>michael_smithe5</dc:creator>
      <dc:date>2022-01-24T14:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484415#M4677473</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I don’t fully
understand your scenario, but hopefully it isn’t really required. In terms of
security, only xsuaa instances talk to each other (OAuth clients and OAuth
authorization servers, more precisely). Fortunately, the error message is
helpful and you’ve found the helpful blog &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
To me it sounds like the mtatest is sending a JWT token to the userinfo.&lt;BR /&gt;
The validation of userinfo looks into the token and reads the aud claim&lt;BR /&gt;There, it
doesn’t find its own clientID&lt;BR /&gt;But userinfo
is required to be mentioned as “receiver”, to be in aud&lt;BR /&gt;So it
fails.&lt;BR /&gt;How to
solve it?&lt;BR /&gt;With grant.&lt;BR /&gt;But you’ve already
declared the grant.&lt;BR /&gt;So what is
missing?&lt;BR /&gt;I have only
one idea:&lt;BR /&gt;The granting
mechanism that you have used: it works only for client-credentials.&lt;BR /&gt;I think
that maybe your scenario is different: probably you have a user-token.&lt;BR /&gt;I mean,
probably you have a human user who logs into your app via approuter&lt;BR /&gt;Approuter
is bound to mtatest-xsuaa.&lt;BR /&gt;Am I right?&lt;BR /&gt;In this
case, the token is a user token&lt;BR /&gt;You can see
in your error message that the aud contains “openid”&lt;BR /&gt;This is
used for login and assigned to users.&lt;BR /&gt;So you
should try the grant mechanism for user-scenario.&lt;BR /&gt;Please find a detailed description &lt;A href="https://blogs.sap.com/2020/06/02/how-to-call-protected-app-from-external-app-as-external-user-with-scope/"&gt;here&lt;BR /&gt;&lt;/A&gt;For
granting you need:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"granted-apps" : ["$XSAPPNAME(application, mtatest)"]&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And for
accepting you need&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"foreign-scope-references": ["$XSAPPNAME(application,userinfo).Display"]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In
addition, I guess you need to assign the required scope to the user&lt;/P&gt;&lt;P&gt;This is
done in a role-template&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;      "scope-references": [
        "uaa.user", 
        "$XSAPPNAME(application,userinfo).Display"
      ]
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Until now
you’ve done a really great job while migrating to CF and setting up all that
required stuff…..! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;Cheers and
good luck !&lt;BR /&gt;Carlos&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 14:08:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484415#M4677473</guid>
      <dc:creator>CarlosRoggan</dc:creator>
      <dc:date>2022-02-18T14:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484416#M4677474</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;carlos.roggan&lt;/SPAN&gt; , I made those changes, but I am still getting the same error. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;  I previously created a role collection called "all" in the subaccount, but this help documentation - &lt;A href="https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/e862ab70c8304b0589491c018b3abc1e.html"&gt;https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/e862ab70c8304b0589491c018b3abc1e.html&lt;/A&gt; - did not specify whether or not to add roles to it.  Does that mean the empty "all" collection has access to every role or to no roles?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 19:05:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484416#M4677474</guid>
      <dc:creator>michael_smithe5</dc:creator>
      <dc:date>2022-02-18T19:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484417#M4677475</link>
      <description>&lt;P&gt;wow - the documentation explains how to create a role collection and how to assign the role collection to a user (in Trust)&lt;BR /&gt;And yes, ONE ESSENTIAL step is missing:&lt;BR /&gt;add the desired roles to the role collection!!!&lt;BR /&gt;An empty role collection is really empty.&lt;BR /&gt;There are always 3 steps described:&lt;BR /&gt;Role - RoleCollection - User&lt;BR /&gt;I mean, even a role collection which contains roles is useless - as long as it is not assigned to a user.&lt;BR /&gt;Only THEN, the user will have roles assigned to him.&lt;/P&gt;&lt;P&gt;And one more hint:&lt;/P&gt;&lt;P&gt;If you've done these 3 steps - and still get error:&lt;BR /&gt;The reason might be that the user-login is kept in the session.&lt;BR /&gt;You need to log in again, otherwise the changes don't take effect and the scopes are not in the token.&lt;BR /&gt;So logout or clean and restart browser, all that is necessary.&lt;/P&gt;&lt;P&gt;hope this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 19:47:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484417#M4677475</guid>
      <dc:creator>CarlosRoggan</dc:creator>
      <dc:date>2022-02-18T19:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484418#M4677476</link>
      <description>&lt;P&gt;one more info:&lt;BR /&gt;I assume you've already done, but just to be on the safe side&lt;BR /&gt;In your destination, you need to have the forward Token property  set to true.&lt;BR /&gt;This is essential for security scenario and this is the trick how  to call protected service from UI5.&lt;BR /&gt;The UI never gets hold of the token, it is completely handled by approuter, which is more safe&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"forwardAuthToken": true&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Feb 2022 19:51:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484418#M4677476</guid>
      <dc:creator>CarlosRoggan</dc:creator>
      <dc:date>2022-02-18T19:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484419#M4677477</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;carlos.roggan&lt;/SPAN&gt; , assigning the roles to the role collection got me a little further, past the 401 error at least, so thank you; however, now I am getting the 403 Forbidden error and I don't see anything in the log that indicates why it is forbidden.  By the way, I had already set forwardAuthToken to true on the destination.  The only I can see in the log of userinfo is that I got a successful login, which I wasn't getting before.  Any thoughts as to what could be causing the 403 error?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 19:34:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484419#M4677477</guid>
      <dc:creator>michael_smithe5</dc:creator>
      <dc:date>2022-02-21T19:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484420#M4677478</link>
      <description>&lt;P&gt;Hi, good to hear that you're one step further.&lt;BR /&gt;Usually, 401 means that user is not authenticated (JWT completely refused)&lt;BR /&gt;403 means one step further, users identity is authenticated, but he does not have the required role for accessing this resource, so he is not authorized.&lt;BR /&gt;I don't know how your "userinfo" app does the authorization check.&lt;BR /&gt;Is there a static configuration? Do you need to specify which scope needs to be checked?&lt;BR /&gt;Is there a default mechanism which you need to override to provide the expected required scope?&lt;BR /&gt;Maybe one approach for troubleshooting:&lt;BR /&gt;You could fully remove the security configuration of your userinfo app. Then check the incoming JWT token.&lt;BR /&gt;It can be introspected, e.g. here &lt;A href="https://jwt.io/"&gt;jwt.io&lt;/A&gt; then use "debugger" to decode the content and view if your required scope is contained.&lt;/P&gt;&lt;P&gt;Note:&lt;BR /&gt;If you copy and paste the scope name into your code or static config, you need to be aware how the scope looks at runtime:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;$XSAPPNAME.Display &lt;/CODE&gt;&lt;/PRE&gt;won’t become &lt;PRE&gt;&lt;CODE&gt;userinfo.Display&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;instead, it
will be something like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;userinfo!t12345.Display&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So you need
to dynamically check the scope.&lt;BR /&gt;Programmatically access the content of $XSAPPNAME and concatenate the full scope
name:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;const UAA_CREDENTIALS = xsenv.getServices({myXsuaa: {tag: 'xsuaa'}}).myXsuaa&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;then    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;const auth = req.authInfo        &lt;BR /&gt;if (!auth.checkScope(UAA_CREDENTIALS.xsappname + '.Display')) {&lt;BR /&gt;       res.status(403).end('Authorization missing.')&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Feb 2022 10:21:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484420#M4677478</guid>
      <dc:creator>CarlosRoggan</dc:creator>
      <dc:date>2022-02-22T10:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484421#M4677479</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;carlos.roggan&lt;/SPAN&gt; , actually the userinfo application does not need to do any scope checking.  I just added the scope to the xs-security.json because I thought that was required for granting access to the approuter.  So, how do I grant the approuter complete access to userinfo without specifying scopes?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 16:16:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484421#M4677479</guid>
      <dc:creator>michael_smithe5</dc:creator>
      <dc:date>2022-02-22T16:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484422#M4677480</link>
      <description>&lt;P&gt;Hi Michael, &lt;BR /&gt;Defining a scope in the xs-security.json and granting it to the mtatest is necessary, because otherwise the userinfo is not added to the aud.&lt;BR /&gt;However, this does only define the scope. This doesn't ENFORCE the scope. This doesn't mean that you must check the scope.&lt;BR /&gt;What I don't know is: if you aren't doing the check manually, who is doing it???&lt;BR /&gt;What library are you using?&lt;/P&gt;&lt;P&gt;One more hint: &lt;BR /&gt;I'm not familiar with the java spring security check mechanism (which I assume you're using?), but there should  be a way to change the log level to DEBUG, such that you get more detailed info about the error&lt;/P&gt;&lt;P&gt;I have one more question:&lt;BR /&gt;Do you really need 2 XSUAA instances at all?&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 20:18:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484422#M4677480</guid>
      <dc:creator>CarlosRoggan</dc:creator>
      <dc:date>2022-02-22T20:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484423#M4677481</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;carlos.roggan&lt;/SPAN&gt;, we are not checking authorization in the web at all - if a user has access to the cloud subaccount, they can click on any tile in the portal site in Neo (which will be Launchpad in CF), the app linked to the tile will then call the userinfo/UserInfo servlet which calls a function module on the Gateway to return the encrypted user id, then that encrypted user id is passed from the UI into each Gateway service call and restful API call where it is decrypted.  Authorization checking is done in the ABAP layer based upon the decrypted id.  The approach prevents the security vulnerability of exposing the unencrypted user id in the UI network calls.&lt;/P&gt;&lt;P&gt;Also, we are not using java spring.  The servlet is very similar to the example in &lt;A rel="nofollow" href="https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/bfcb54ca058f4b1dafd26e438ff1e2f4.html" target="_blank"&gt;Invoke ABAP Function Modules in On-Premise ABAP Systems&lt;/A&gt;  .  I don't know whether we need 2 XSUAA instances or not??  We have other UI5 apps we eventually need to bring onto CF as well that also use the userinfo utility - does that mean userinfo will need its own XSUAA instance or would it just be included in the XSUAA instance of each UI5 app?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 20:55:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484423#M4677481</guid>
      <dc:creator>michael_smithe5</dc:creator>
      <dc:date>2022-02-22T20:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484424#M4677482</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;thanks for describing your scenario more in detail and I agree: it makes sense
to have a separate utility-app that can be reused. It was just a question,
there should be no reason why it shouldn’t work.&lt;/P&gt;&lt;P&gt;Today, I’ve set up a little scenario, to reproduce your scenario – and for me
it works, even the scope is sent….&lt;BR /&gt;I can send you this mini-project, so you can check and compare.&lt;/P&gt;&lt;P&gt;Can you try calling the approuter-route
directly, not via webapp, but directly the route-URL?&lt;/P&gt;&lt;P&gt;One more
info, just in case:&lt;BR /&gt;In
approuter config, xs-app.json file, if you don’t specify the properties authenticationMethod
and authenticationType, then the default is always "xsuaa".&lt;BR /&gt;If you don’t
need authentication, you have to set it to "none".&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 16:54:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484424#M4677482</guid>
      <dc:creator>CarlosRoggan</dc:creator>
      <dc:date>2022-02-23T16:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484425#M4677483</link>
      <description>&lt;P&gt;And one more hint:&lt;/P&gt;&lt;P&gt;I’ve set
the logging level of approuter, so I can see all the logs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cf set-env &amp;lt;yourapprouter&amp;gt;  XS_APP_LOG_LEVEL debug&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then I let
the session expire.&lt;BR /&gt;Then I test
my app and in the browser I get “Unauthorized”, HTTP code is 401&lt;BR /&gt;In the CF
log I see the error message and the stack trace of approuter internal:&lt;BR /&gt;&lt;BR /&gt;"msg":"GET
request to /route/userinfo/ completed with status 401 Authentication
required"&lt;BR /&gt;&lt;BR /&gt;And the
stacktrace shows that approuter tries to get the JWT token from session:&lt;/P&gt;

&lt;P&gt;at
SessionStrategy.strategy.pass&lt;/P&gt;

&lt;P&gt;and fails:&lt;/P&gt;

&lt;P&gt;@sap/approuter/lib/middleware/login-middleware.js:41:15)&lt;/P&gt;

&lt;P&gt;This is
just to give you an example for troubleshooting the approuter.&lt;BR /&gt;I’ve seen
the sample java servlet given in your link, and I agree with you, this doesn’t
seem to reject your request.&lt;BR /&gt;So it means
that approuter would be the responsible.&lt;BR /&gt;Some configuration
issue?&lt;BR /&gt;So please
try to investigate with log level&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 18:00:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484425#M4677483</guid>
      <dc:creator>CarlosRoggan</dc:creator>
      <dc:date>2022-02-23T18:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I access a Java servlet from a UI5 application in Cloud Foundry?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484426#M4677484</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;carlos.roggan&lt;/SPAN&gt; , I sent you an email requesting the mini-project - I am hopeful that will help clear up my confusion.  Thank you so much for all your patience and help!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 22:05:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-do-i-access-a-java-servlet-from-a-ui5-application-in-cloud-foundry/qaa-p/12484426#M4677484</guid>
      <dc:creator>michael_smithe5</dc:creator>
      <dc:date>2022-02-23T22:05:10Z</dc:date>
    </item>
  </channel>
</rss>

