Feature #4855
add a 4GL extension SESSION:SESSION-ID attribute which returns a UUID which uniquely identifies a FWD session
100%
Related issues
History
#1 Updated by Greg Shah almost 4 years ago
The purpose of this is to allow converted 4GL code to uniquely identify a given session. A customer has requested this to allow them to implement some internal licensing logic.
#2 Updated by Greg Shah almost 4 years ago
- Related to Feature #4853: implement support for reporting a device-id which is meant to identify a unique client system/browser accessing the FWD server added
#4 Updated by Greg Shah 11 months ago
I expect that the customer will likely implement their own "licenses in use" table (see #4522) in which one field will be the session id. They can implement Session Init Term Hooks in Java to remove the record when the session exits.
For the purposes of this task, we just need to have that unique ID for the lifetime of the session.
#9 Updated by Greg Shah 11 months ago
You can have a virtual session while in an active direct session. You cannot have a virtual session on its own, the idea is that it is a special server-to-server multiplexed session.
You don't have to map the session id to the FWD direct session or FWD virtual session per se. We don't need to distinguish between these FWD session types. From a 4GL code perspective, there is only ever one "session" and that is what we are representing here.
#10 Updated by Greg Shah 11 months ago
I'm just trying to figure out if there is any case where the id should be stable in different
BaseSession
objects.
I don't want to map this to a FWD session. This is about the 4GL session, which follows the Highlander principle..
#11 Updated by Galya B 11 months ago
BaseSession
aside. A session from 4GL perspective should be:
- the unique conversation (with standalone gui/chui/batch processes and web gui/chui/embedded);
- the unique connection to appserver (running external procedures)?
- the unique connection to rest / soap?
#12 Updated by Greg Shah 11 months ago
the unique conversation (with standalone gui/chui/batch processes);
Yes
the unique connection to appserver (running external procedures)?
Yes, though the lifetime is dependent upon the connection type (stateful, state free, state reset...).
the unique connection to rest / soap?
Yes, though the lifetime is dependent upon the agent.
I think we don't need to consider this too much. Calculate the value only when it is first read and store it in the SessionUtils.WorkArea
. The lifetime of that context will already be properly managed and you don't need to deal with it. If the value is never read, then it is never calculated and is just set to null
by default.
#14 Updated by Galya B 11 months ago
What is client-principal:session-id
https://docs.progress.com/bundle/abl-reference/page/SESSION-ID-attribute.html#SESSION-ID-attribute . We have that implemented in com.goldencode.p2j.util.ClientPrincipal
as SESSION_ID(AttrType.CHAR, 0xf, "SESSION-ID"),
.
#15 Updated by Constantin Asofiei 11 months ago
Galya B wrote:
What is
client-principal:session-id
https://docs.progress.com/bundle/abl-reference/page/SESSION-ID-attribute.html#SESSION-ID-attribute . We have that implemented incom.goldencode.p2j.util.ClientPrincipal
asSESSION_ID(AttrType.CHAR, 0xf, "SESSION-ID"),
.
The attribute is r/w, so it can be set by the application to anything (thus uniqueness is not guaranteed). And it belongs to CLIENT-PRINCIPAL.
#16 Updated by Greg Shah 11 months ago
The client-principal
is a kind of 4GL based security-related token that identifies an authenticated identity. It is not guaranteed to be used at all (you have to write your 4GL code to use it) and this usage requires other code to handle the authentication. It is also not guaranteed to be stable for the entire lifetime of the 4GL session. It can be swapped out or logged out and replaced.
Our session-id will have no relation to the client-principal
.
#19 Updated by Constantin Asofiei 11 months ago
If we reuse this keyword, SESSION-ID
will need to be extracted to its own interface, specific handle.unwrap
added for this attribute, and some conversion rules changes, also.
#30 Updated by Constantin Asofiei 10 months ago
The changes in trunk rev 14661 are not OK. As SESSION-ID exists now at both CLIENT-PRINCIPAL and SESSION, we need this attr in a dedicated interface, with its own handle.unwrap method (as mentioned at #4855-19.
#34 Updated by Constantin Asofiei 10 months ago
This test needs to work properly to validate the fix:
def var ch as char. def var h as handle. create client-principal h. h:session-id = "abc". ch = h:session-id. message ch. session:session-id = "123" no-error. // this will raise an ERROR condition message error-status:error error-status:get-message(1). ch = session:session-id. message ch.The steps are these:
- extract the
SESSION-ID
getter/setter into their own interface (both setters withcharacter
andString
parameters) - add this interface to
CommonSession
andClientPrincipal
- add a
handle.unwrapSessionId
API for this interface - implement the setter in
SessionUtils
, to just callreadOnlyError
- change
methods_attributes.rules
to use this 'unwrap' API.
#35 Updated by Galya B 10 months ago
4855b r14663-14664 I can't make it work:
Sessionid.java:36: error: cannot find symbol [javac] silent(() -> new character("123").setSessionId()); [javac] ^ [javac] symbol: method setSessionId() [javac] location: class character [javac] /home/gbb/Code/testcases-working/src/com/goldencode/testcases/galya/Sessionid.java:42: error: no suitable method found for assign(no arguments) [javac] ch.assign(); [javac] ^ [javac] method BaseDataType.assign(BaseDataType) is not applicable [javac] (actual and formal argument lists differ in length) [javac] method BaseDataType.assign(jobject<?>) is not applicable
I think all is correct, but I wasn't able to find the right unwrap in methods_attributes.rules
. I tried different variants, all seem the same to me.
#36 Updated by Constantin Asofiei 10 months ago
You need this code adjusted for SESSION-ID, in methods-attributes.rules, the section for SESSION handle:
<rule>ftype == prog.kw_sessn_id <action>hwrap = "SessionId"</action> <action>methodText = "SessionUtils.getSessionId"<action> <rule>isAssign <action>methodText = "SessionUtils.setSessionId"</action> </rule> </rule>
#38 Updated by Constantin Asofiei 10 months ago
Review for 4855b/14665 - I'm OK with the changes.