Capture Session Timeout in SAP cloud foundry application - sap-cloud-platform

Iam developing a SAP CF app and wnated to capture session timeout and show pop-up to user before session timeout happs to either refresh the session or execute the logout ,but setting the env variable SESSION_TIMEOUT as given in the link is also not working neither central logout is triggered :
https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.03/en-US/0aac697f0cf7444193ed5eb0fc6e5bd0.html#loio0aac697f0cf7444193ed5eb0fc6e5bd0__section_blz_hgn_mv
cf set-env SESSION_TIMEOUT 1
it is not triggering the central logout endpoint configured in xs-app.json. My client initiated central logout is working as expected.
please help with any suggestions and pointers ,my requirement is to capture central logout event on session expiry and show popup to user to either refresh the session or execute logout but this is not working in SAP Cloud foundry environment ,please help.

To be honest, I have no experience about this.
But the link provided (https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.03/en-US/5f77e58ec01b46f6b64ee1e2afe3ead7.html#loio5f77e58ec01b46f6b64ee1e2afe3ead7__section_imh_gsy_lv) is about the app router configuration.
It says,
The sessionTimeout property is no longer available; to set the session time out value, use the environment variable .
Therefore, I would try to set the environment variable for the app router as well, e.g., via the manifest.yaml.

The documentation you linked to is for the HANA XS advanced model, which I think is different to the approuter used on Cloud Foundry. Therefore, I'd assume that the documentation won't help you much.
Adding an environment variable to your app alone won't do much either, I fear. Unless you tell your app to do something with that.
Bottom-line: I think you need to implement that functionality yourself.

Related

How Do I Bypass Google SSO for selenium?

I am trying to access some services that require a google login. I thought it would be a really neat idea to automate it and have been trying to do so. Whenever I use my script to launch my service its asking me to sign in with google account. I am tried to automate that also in automation but I am getting captcha . Please someone help me in do this.
I have tried in one way:
By default, ChromeDriver will create a new temporary profile for each session. Manually u won't get sso as it is using stored cache. So the solution is u need to create and load custom profile
Something like this
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=/path/to/your/custom/profile")
Note : Its work fine when I run in single thread but When I am running in multiple thread I am getting an error message saying "Directory already in use".

Bing Ads API - Can not authenticate - Authentication challenge in Python SDK

I am facing the challenge to request the Bing Ads API to get a couple of metrics from it.
I am using Apache Airflow DAGs hosted on a remote Kubernetes cluster to do so. It is a nice way to automate and schedule tasks.
Now, the documentation is rather light on the point of gaining access to the API.
I have followed this https://learn.microsoft.com/en-us/advertising/guides/authentication-oauth-identity-platform?view=bingads-13#registerapplication
and the official SDK docs https://github.com/BingAds/BingAds-Python-SDK/.
I am failing at authenticating when querying, since I am lacking a couple of pieces of information.
When authenticating using the "refresh token" and "redirect URI", I do not have either. (Class OAuthWebAuthCodeGrant here: https://github.com/BingAds/BingAds-Python-SDK/blob/294d01eea57d80ba381a42cde8d006fc318af056/bingads/authorization.py#L566)
When using a different method (Class OAuthDesktopMobileAuthCodeGrant here: https://github.com/BingAds/BingAds-Python-SDK/blob/294d01eea57d80ba381a42cde8d006fc318af056/bingads/authorization.py#L532), I fail w/
AADSTS700016: Application with identifier '<someidentifier>' was not found in the directory '<somethingelse>'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.
Thank you very much in advance! If you need more details, let me know!
Also great documentation in general, if I can make it more "newb"-friendly, let me know!
Edit1:
Sadly, while there has been some traffic to this question, nobody seems to be able to answer.
I will specify the set up a bit further.
We use Airflow DAGs to request daily updates from the API. For this, we need to authenticate. The authentication comes from a "new device" every time, since the code runs on a k8s cluster which allocates the jobs dynamically to it's pods.
For authentication, we ventured into different solutions, but all require some form of human interaction to get the refresh token into the DAG.
Is there any solution which allows for a hands-free deamon like many-server-to-server communication?
This link sheds some light on what we are looking for: https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-app-registration#api-permissions---app-permissions-and-admin-consent
Sadly, the Bing Ads API does not show up there.
What key piece of information are we missing?
Bing Ads, like Google Ads, uses OAuth for its API.
If you reference the Getting Started page, it mentions that you need a developer token, complete with links.
You can follow these steps to get a developer token for production.
Sign in with Super Admin credentials at the Microsoft Advertising Developer Portal account tab.
Choose the user that you want associated with the developer token. Typically an application only needs one universal token regardless how many users will be supported.
Click on the Request Token button.
Regarding your specific scenario--an application running in the cloud without an interface--you should know that OAuth requires you to interact with it to set things up. So run your app locally ONCE, or at least the getting_started code from your language's walkthrough: https://learn.microsoft.com/en-us/advertising/guides/walkthrough-desktop-application-python?view=bingads-13
Running it locally will go through the authentication process with your browser and generate a refresh token (in the file refresh.txt by default). Store this file with your code. It will have to be on the server that's making the request, and since it's in Kubernetes, you'll have to keep it with your container file.

fiware spagobi api rest validate with keyrock

I have 3 instances:
1.- app web (ubuntu instance)
2.- keyrock instance
3.- spagobi instance
My spagobi instance works validating users with keyrock as the same as App web. I create some reports in it. Now, i need to get these reports to insert into my app web.
Im trying to use http://docs.spagobi.apiary.io/, The preview subresource option. But all times i have a modal window asking my user/pass (as a apache security option).
im using http://spagobi-url/SpagoBI/restful-services/2.0/documents/printers_visited/preview (printers visited is the label of my document). And results:
If i wrote my user/pass in this panel, validation dont work and tries as a loop.
Anyone know how to solve this?
the REST services provided by SpagoBI require basic authentication, that's why you see the modal window asking for credentials.
In order to avoid this, you should implement a SSO between your application and SpagoBI and open a session in SpagoBI: when the session is opened, you should be able to invoke REST services.
Pay attention to the fact that preview subresource is just a static (optional file), it is not the executed report: if you want to execute the report, you should get the content subresource.
Just to let you know, we are currently developing possibility to invoke REST services providing the OAuth token. This should be available in next release.
Hope this helps

Fetching User credentials in UI5 application dynamically for External services

Currently we have requirement to develop a custom Fiori App using external Restful Web services. I am able to get the data from the back end using basic authentication. Kindly find the below image for details. I have hard coded one of our back end user credentials in the image below.
Working code
Our back end is having only this basic authentication option to fetch the data. We have only this possibility to fetch back end data. Currently it is working fine with single user credentials. Now my requirement is that i will deploy this app in the front end server. We will be using Single sign on option for our implementation in Front end server. So front end credentials will be same as back end credentials.
After the user logged in from Fiori Client in the mobile. Is there any option to fetch the user credentials in the Java script from the current user session or from cookies so that i consume our back-end Restful service using the dynamic approach.
Please help me out.
Regards
Phani Poorna
The mentioned scenario might be possible if SingleSignOn is also configured for the backend.
Otherwise, we don’t see a possibility to get the SSO user credentials via Javascript from the current user session nor from cookies.

How to manage session with ember framework?

I have been asked to use ember for front end and java rest services as the backend. I am trying to figure out how to manage session for a particular user.
i know there are couple of options like storing in the local store, cookie but they are error prone as some users might disable those features. I want to know what is the preferred approach in normal enterprise apps.
Mine app is simple 15 page app. i need to capture user, and some profile details.
Session are usually more of server side part. You have to just make sure whether the provided session is available or not for every transformed route and request. There is a library which takes care of authentication and authorization in ember https://github.com/simplabs/ember-simple-auth.