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.
Related
I'm currently working on a VueJS project on which I've just implemented a SSO system designed by the Portuguese government using our national identity cards, but I'm having some issues parsing the response from the external authentication server.
Here's a small GIF of my problem: https://gfycat.com/threadbarepossiblebagworm
The workflow is as follows:
User clicks on Authenticate.
User chooses "Login via ID Card"
User gets redirected to the external Authentication Provider
User logins with his ID Card.
External Authentication provider then sends back a POST method to the callback URL that is provided.
I read/parse the callback
The issue lies in step 6... The external authentication provider uses the callback URL I provided but I get this error
Cannot POST /users/callback
If this was a typical NodeJS I could just use
router.post('/callback' ....)
Is there a way I can read that callback in VueJS?
I've found this similar issue https://forum.vuejs.org/t/cannot-post-handling-form-post-from-an-external-site/41194/1 but no one managed to offer him a solution.
Thanks in advance!
EDIT: Before you ask, yes, that '/users/callback' is defined on router.ts and if I go to that route it does show a page. It's just not designed for POST methods afaik
Vue is a front-end framework, which means it doesn't have direct access to POST requests by default.
For production, are you running an npm script like "npm run build" and then serving the files that appear in the "dist" folder on a webserver, say Apache? Then you would have to respond to the POST request in Apache.
You could then store their authentication result "farther toward the backend" than Vue and have Vue grab it with vuex.
Im writing a user registration mechanism by hand so I dont want to use existing plugins or something.
Im wondering what the best way would be. I planning to do the following abstract steps:
Writing an component which is in charge to output a button which calls the facebook-api --> login in via facebook (Im getting token and user name/id)
In my route im using that Data to call the REST-Server-Backend of my app. I will pass the token as well as the username/id to the Server. (POST api.myapp.com/users)
The Server recieves the request and will validate via Facebook-API
the user data and token on its own --> if valid: Add new user to
database.
If the user wants to login now (after registration) he will do again
step no.1 and than will ask the server if the user is existing. But
how: Since ember suggest that the REST-Server is somekind of a
CRUD-Server and using the store is for working for model data only, there
is no possiblity to do a "logic"-call to the server like "ask
him if user with id is existing". Should I call "GET ../users/" and than check in my route if the sum of the returned records are smaller than 1?
So is that a common pattern?
Sounds like a fairly simple OAuth workflow but obviously refer to the facebook docs. As far as point 4 is concerned, I would suggest that yes, on login you make a request for the login route on your server (which should abstract the facebook OAuth call), and if the user is authenticated, then send down the user resource, otherwise redirect them to the login and send down some sort of 401 HTTP error.
As all your API calls should be authenticated too your user won't be able to access any protected API resources.
I would also suggest you look into an ember plugin like ember-simple-auth which also supports OAuth.
You can find more information about OAuth2 workflows here.
I need integrate Liferay (version 6.2) with another service which stores information about users. Communication with service occurs through SOAP.
Is it possible use users from service to authenticate to Liferay?
Liferay integrates with external systems through LDAP already. If you use that interface, you're set. If you need a proprietary API to access user information, you will have some work in front of you.
It might be worth examining the SSO implementation and intercept newly authenticated users on this level: With the user's identity, create or update a Liferay user account on the fly through LIferay's API. To me this looks like the most promising approach from an effort/maintenance point of view, with the little information I have about your situation.
Alternatively you could batch-update all (Liferay-) user accounts from time to time, based on updates in your external system.
Let me see if I understand what need:
1- Step 1: User prompted with A login page.
2- Step 2: The credentials entered by the user are checked against a web service (could be any service)
3- Step 3: The user is either logged in or an auth error displayed to the user.
If that's what you need, then create an autologin hook. The code that call the webs service shall live in the autologin hook.
May seem intimidating, but it is trivial: likely liferay comes with a bunch of them: (take one of them as a template)
auto.login.hooks=com.liferay.portal.security.auth.CASAutoLogin,com.liferay.portal.security.auth.FacebookAutoLogin,com.liferay.portal.security.auth.NtlmAutoLogin,com.liferay.portal.security.auth.OpenIdAutoLogin,com.liferay.portal.security.auth.OpenSSOAutoLogin,com.liferay.portal.security.auth.RememberMeAutoLogin,com.liferay.portal.security.auth.SiteMinderAutoLogin
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.
Greeting everyone, may I ask your help for following question?
I'm using following code to call external browser in my current iPhone apps:
[[UIApplication sharedApplication] openURL:urls];
urls = "http://myhost.net/home.aspx"
Assume user is already logged in to the apps,
I can to pass the user name password to "home.aspx" if security is not a concern...
e.g. urls = "http://myhost.net/home.aspx?username=xxx&password=123456"
Question 1: Can I pass some information to home.aspx by "post" instead of "get" method?
Question 2
If above solution is not possible, I would like to set basic authentication in IIS 7.
When the external browser called by apps, can users access to "home.aspx" without 2nd login? (e.g. use code to bypass it)
For Q2, here is my current situation for your reference:
1) I have video steaming service provided by Windows IIS, when user type the URL from browser, the login form will prompt. a. e.g. xxxx/video.htm b. The IIS is configured with SSL and basic authentication
2) After user login succeed, the video should be properly displayed in the HTML 5 page.
3) We have the iPad/iPhone apps will open the external browser (i.e. Safari) to see the video page, but I don't know how can by pass the authentication (i.e. user should not see login form) if user already logged in the app within 15 mins.
Many thanks for your attention.
Re: August
About question 2, "[[UIApplication sharedApplication] openURL:urls];"
In theory you can do it for non-video streaming hyperlinks, but there are no solution or workaround for video streaming in similar passthough scenario.
Please also see:
Stream MP4 Video From Seek Position in ASP.NET
Both handler or REST web service require header handling but that might be product limitation because no existing APIs work for it.
Hope this helps.
As far as your question is concern, you can only pass variables to a web url if and only if you a Web Service like REST or SOAP installed on your local or remote server. You can search for Web Service API's for ASP.net that suits your need. From there, you can authenticate any variables by setting the response in every request. You can start with this.
On the other end (in the iphone), you can't just use your code above to send request, this can be done using the native iOS url connection but I do recommend to use libraries like RESTKit or probably ASIHTTPRequest. Both handle requests like get, post, delete and update.