Get the logged in users ID in a REST request?

Posted by Paul Radbone on 12-Dec-2014 15:07

Hi,

Is it possible to see the User ID for the request on the REST service on the appserver?  I can get a SESSION ID with MESSAGE SESSION:CURRENT-REQUEST-INFO:ClientContextId, but I would also like to know the user.

Thanks,

Paul.

Posted by Michael Jacobs on 12-Dec-2014 15:16

Hello Paul,

Use SESSION:CURRENT-REQUEST-INFO:GetClientPrincipal()

If it returns unknown - the REST service authenticated an anonymous user, or the OEClientPrincipalFilter was disabled.

If it returns a valid handle it will be the user-id authenticated by the REST service and the roles they were granted.

If the Client-Principal's session-id attribute is "0" it is a stateless (i.e. HTTP BASIC) REST request, or non-zero indicates a statefull REST request ( i.e. HTTP Form ) 


Mike J.

[collapse]
From: "paul.radbone@wins.co.uk" <bounce-paulradbonewinscouk@community.progress.com>
Reply-To: "TU.OE.Development@community.progress.com" <TU.OE.Development@community.progress.com>
Date: Friday, December 12, 2014 at 4:08 PM
To: "TU.OE.Development@community.progress.com" <TU.OE.Development@community.progress.com>
Subject: [Technical Users - OE Development] Get the logged in users ID in a REST request?

Thread created by paul.radbone@wins.co.uk

Hi,

Is it possible to see the User ID for the request on the REST service on the appserver?  I can get a SESSION ID with MESSAGE SESSION:CURRENT-REQUEST-INFO:ClientContextId, but I would also like to know the user.

Thanks,

Paul.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

All Replies

Posted by Michael Jacobs on 12-Dec-2014 15:16

Hello Paul,

Use SESSION:CURRENT-REQUEST-INFO:GetClientPrincipal()

If it returns unknown - the REST service authenticated an anonymous user, or the OEClientPrincipalFilter was disabled.

If it returns a valid handle it will be the user-id authenticated by the REST service and the roles they were granted.

If the Client-Principal's session-id attribute is "0" it is a stateless (i.e. HTTP BASIC) REST request, or non-zero indicates a statefull REST request ( i.e. HTTP Form ) 


Mike J.

[collapse]
From: "paul.radbone@wins.co.uk" <bounce-paulradbonewinscouk@community.progress.com>
Reply-To: "TU.OE.Development@community.progress.com" <TU.OE.Development@community.progress.com>
Date: Friday, December 12, 2014 at 4:08 PM
To: "TU.OE.Development@community.progress.com" <TU.OE.Development@community.progress.com>
Subject: [Technical Users - OE Development] Get the logged in users ID in a REST request?

Thread created by paul.radbone@wins.co.uk

Hi,

Is it possible to see the User ID for the request on the REST service on the appserver?  I can get a SESSION ID with MESSAGE SESSION:CURRENT-REQUEST-INFO:ClientContextId, but I would also like to know the user.

Thanks,

Paul.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Paul Radbone on 12-Dec-2014 15:40

Great, thanks for that, just what I was looking for.

This thread is closed