5.2 REST - system.variables.$USER.value
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 331
- Joined: Mon Mar 10, 2014 8:34 am
5.2 REST - system.variables.$USER.value
Hi, I've done a clean install on a DEV server of 5.2 this morning. I've set it up to run under IIS so system.variables.$USER.value is populated from within a form.
I need to publish a RESTful web service but system.variables.$USER.value isn't being populated.
I've checked the header and Authorisation is being passed.
The user id is available to the API if I call it from a session that has already called a form (if that makes sense).
Please advise.
I need to publish a RESTful web service but system.variables.$USER.value isn't being populated.
I've checked the header and Authorisation is being passed.
The user id is available to the API if I call it from a session that has already called a form (if that makes sense).
Please advise.
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
-
- Ebase User
- Posts: 331
- Joined: Mon Mar 10, 2014 8:34 am
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
The idea is that a REST service is completely independent of the caller, and the caller could be anything - it doesn't have to be an Ebase application and the concept of a user may not apply. Similarly there is no built-in security for a REST service, we thought that customers who want to implement security would just pass authentication information as header variables, then they are free to encrypt/decrypt these in any way.
How were you planning on using $USER from the REST service? Maybe we can find another way.
How were you planning on using $USER from the REST service? Maybe we can find another way.
0 x
-
- Ebase User
- Posts: 331
- Joined: Mon Mar 10, 2014 8:34 am
Hi Jon, we are developing a dataPortal to bring datasets together in an api.
External users will not require any authorisation (there is the potential for partner data to require security and at this stage we were thinking oAuth or some other security mechanism).
I was intending (hoping) to validate an internal user so we can return data based on the user's name - eg access to a specific dataset or even return different content based on the userid (row based security).
Internally we want to get user's into Business Intelligence and they can consume rest services either through Excel Power Query or the likes of Power BI (Tableau etc).
I want the internal access to be seamless so 1 user can develop a model and then just distribute it out and other users just get the right data.
We've had a couple of thoughts about extracting the info from IIS and then pump it onto the Ebase REST or the potential to investigate what potential there is in our NetScallers.
Thanks
External users will not require any authorisation (there is the potential for partner data to require security and at this stage we were thinking oAuth or some other security mechanism).
I was intending (hoping) to validate an internal user so we can return data based on the user's name - eg access to a specific dataset or even return different content based on the userid (row based security).
Internally we want to get user's into Business Intelligence and they can consume rest services either through Excel Power Query or the likes of Power BI (Tableau etc).
I want the internal access to be seamless so 1 user can develop a model and then just distribute it out and other users just get the right data.
We've had a couple of thoughts about extracting the info from IIS and then pump it onto the Ebase REST or the potential to investigate what potential there is in our NetScallers.
Thanks
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Steve,
You should be able to get the user (if any) by calling client.request.getRemoteUser() from the REST code. This is the same call as the Ebase system makes to extract a Windows userid for an interactive session. I would guess that if the request is coming from a Windows app e.g. Excel, then this would return the Windows userid. You might find that it also contains the Windows domain name and you might need to strip this off.
Jon
You should be able to get the user (if any) by calling client.request.getRemoteUser() from the REST code. This is the same call as the Ebase system makes to extract a Windows userid for an interactive session. I would guess that if the request is coming from a Windows app e.g. Excel, then this would return the Windows userid. You might find that it also contains the Windows domain name and you might need to strip this off.
Jon
0 x
-
- Ebase User
- Posts: 331
- Joined: Mon Mar 10, 2014 8:34 am
-
- Ebase User
- Posts: 331
- Joined: Mon Mar 10, 2014 8:34 am
Hi Jon, back in the office today and I've tried what you suggested.
That is attempting to get the user id via "client.request.getRemoteUser()"
I'm getting the following error
I've also tried pointing PowerQuery and PowerBI at an Ebase form to prove that the Ebase Tomcat running under IIS can pass the credentials successfully. It does although the intial page back gives a 302 error so Power BI and Power Query do not actually show any of the content (this is just to prove the point rather than needing pull Ebase form content into Power BI and Power Query).
Thanks
That is attempting to get the user id via "client.request.getRemoteUser()"
I'm getting the following error
I've tried a different .net rest service that we have internally in both Power Query and Power BI and it works exactly as expected. That is anonymous requests are not supported so Power Query and Power BI whinge "the user was not authorized" until I select "Use my current Windows credentials"ReferenceError: "client" is not defined.
I've also tried pointing PowerQuery and PowerBI at an Ebase form to prove that the Ebase Tomcat running under IIS can pass the credentials successfully. It does although the intial page back gives a 302 error so Power BI and Power Query do not actually show any of the content (this is just to prove the point rather than needing pull Ebase form content into Power BI and Power Query).
Thanks
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
"client" missing from the REST service API is our problem, we can address that in the next release. In the meantime you should be able to use this temporarily instead:
Code: Select all
var user = formservlets.HttpRegister.getHttpServletRequest().getRemoteUser();
0 x
-
- Ebase User
- Posts: 331
- Joined: Mon Mar 10, 2014 8:34 am
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Sorry, should be..
Code: Select all
Packages.formservlets.HttpRegister.getHttpServletRequest().getRemoteUser();
0 x
-
- Ebase User
- Posts: 331
- Joined: Mon Mar 10, 2014 8:34 am
Who is online
Users browsing this forum: No registered users and 18 guests