Kbase P147950: 4GL/ABL: How to use the LOAD-DOMAINS( ) method of the SECURITY-POLICY system handle to CREATE a CLI
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/17/2009 |
|
Status: Unverified
GOAL:
4GL/ABL: How to use the LOAD-DOMAINS( ) method of the SECURITY-POLICY system handle to CREATE a CLIENT-PRINCIPAL object?
GOAL:
How to invoke the SET-CLIENT( ) method of the SECURITY-POLICY system handle?
GOAL:
How to set the default USERID for the ABL session using the SET-CLIENT( ) method of the SECURITY-POLICY system handle?
GOAL:
How to define or set a CLIENT-PRINCIPAL object application property?
GOAL:
How to access or get a CLIENT-PRINCIPAL object application property?
FACT(s) (Environment):
All Supported Operating Systems
OpenEdge 10.1x
OpenEdge 10.2x
FIX:
The following sample code, demonstrates how to:
1. Use the LOAD-DOMAINS( ) method of the SECURITY-POLICY system handle to CREATE a CLIENT-PRINCIPAL object.
2. Invoke the SET-CLIENT( ) method of the SECURITY-POLICY system handle.
3. Set the default USERID for the ABL session using the SET-CLIENT( ) method of the SECURITY-POLICY system handle.
4. Define or set a CLIENT-PRINCIPAL object application property.
5. Get a CLIENT-PRINCIPAL object application property.
Additionally, the procedure displays some of the attributes and methods for the SECURITY-POLICY system handle and the CLIENT-PRINCIPAL object.
IMPORTANT NOTE: Before running this code, an Authentication System Domain must exist. To create an Authentication System Domain, use the Authentication System Maintenance utility of the Database Administration Tool. The already existing Domain Name must be "myAuthenticationSystemDomainName" and the Domain Access Code must be "myAuthenticationSystemDomainAccessCode":
DEFINE VARIABLE pcUser AS CHARACTER NO-UNDO.
DEFINE VARIABLE gcDomainName AS CHARACTER NO-UNDO.
DEFINE VARIABLE gcDomainKey AS CHARACTER NO-UNDO.
DEFINE VARIABLE ghCP AS HANDLE NO-UNDO.
DEFINE VARIABLE lOK AS LOGICAL NO-UNDO.
ASSIGN
gcDomainName = "myAuthenticationSystemDomainName"
gcDomainKey = "myAuthenticationSystemDomainAccessCode"
pcUser = "JackInTheBox".
SECURITY-POLICY:LOAD-DOMAINS (LDBNAME(1)).
CREATE CLIENT-PRINCIPAL ghCP.
ghCP:SET-PROPERTY("myPrtopertyName", "myPropertyValue").
ASSIGN
ghCP:USER-ID = pcUser
ghCP:DOMAIN-NAME = gcDomainName
ghCP:SESSION-ID = SUBSTRING(BASE64-ENCODE(GENERATE-UUID),1,22).
lOk = ghCP:SEAL(gcDomainKey).
MESSAGE "SEAL(gcDomainKey):~t" lOk
VIEW-AS ALERT-BOX INFO BUTTONS OK.
lOk = ghCP:VALIDATE-SEAL(gcDomainKey).
MESSAGE "VALIDATE-SEAL(gcDomainKey):~t" lOk
VIEW-AS ALERT-BOX INFO BUTTONS OK.
lOk = SET-DB-CLIENT(ghCP).
MESSAGE "SET-DB-CLIENT:~t" lOk
VIEW-AS ALERT-BOX INFO BUTTONS OK.
lOk = SECURITY-POLICY:SET-CLIENT (ghCP).
MESSAGE "SECURITY-POLICY:SET-CLIENT:~t" lOK
VIEW-AS ALERT-BOX INFO BUTTONS OK.
MESSAGE
"~t~tSELECTED CLIENT-PRINCIPAL ATTRIBUTES VALUES" "~n"
"CLIENT-PRINCIPAL DOMAIN-NAME: ~t" ghCP:DOMAIN-NAME "~n"
"CLIENT-PRINCIPAL LOGIN-STATE: ~t" ghCP:LOGIN-STATE "~n"
"CLIENT-PRINCIPAL SESSION-ID: ~t" ghCP:SESSION-ID "~n~n"
"~t~tSELECTED CLIENT-PRINCIPAL METHODS RETURN VALUES" "~n"
"CLIENT-PRINCIPAL AUTHENTICATION-FAILED( ): ~t" ghCP:AUTHENTICATION-FAILED( ) "~n"
"CLIENT-PRINCIPAL GET-PROPERTY ('myPrtopertyName'ONG>):~t" ghCP:GET-PROPERTY("myPrtopertyName") "~n"
"CLIENT-PRINCIPAL LIST-PROPERTY-NAMES(): ~t" ghCP:LIST-PROPERTY-NAMES( )
VIEW-AS ALERT-BOX INFO BUTTONS OK..