MultiValue Tools

 View Only
  • 1.  SB/XA Integration with Smart Cards to Login/Logout/Switch Users

    Posted 06-23-2022 10:23
    Hi

    I am looking to support a scenario where multiple users share a single workstation and want to work in my SBXA application within the context and constraints of their own user accounts.

    I'd like to make this switch of user accounts (which is frequent) as quick and painless as possible. And my initial thoughts are to explore smart cards/NFC cards and readers to achieve this.

    Wondering if anyone has given some thought to how one might go about integrating smartcard/NFC readers with SBXA.

    Initial thoughts are to explore custom control in SB/XA written in .NET and have it listen for commands and invoke BASIC program to login/logout etc.

    Not sure if there will be any way to programmatically log a different user in, or whether the SH.SEC.API can decrypt a password, or whether switch of users can occur without knowing the password.

    Note windows single sign on is not and cannot be used.

    I would welcome some idea or alternative approaches that the community has implemented to address a similar challenge.

    Thanks in Advance


    ------------------------------
    Aaron Glover
    AU
    ------------------------------


  • 2.  RE: SB/XA Integration with Smart Cards to Login/Logout/Switch Users

    PARTNER
    Posted 06-24-2022 03:52
    hi Aaron,

    I'll respond about 'SBuser switch'.

    When a sbuser is logged in, all the info about it are loaded into common block /SBPLUS/ PASS.DEFN USER.ID USER.KEYS  + DMSECURITY $PASS@PORT $PORT@PORT $USERKEY@PORT  records. 

    Then you can create a in-memory stack of sbuser's info.
    this sample is a mix of basic/paragraph but you get the idea .
    SUBROUTINE STACKSBU(MODE,SBUSER)
    COMMON /LOGGEDSBUSER/ U.SBUSERS, U.DATA(100,2)
    IF NOT(ASSIGNED(U.SBUSERS)) THEN U.SBUSERS = '' ; MAT U.DATA = '' 
    
    FOUND = 0
    LOCATE(SBUSER,U.SBUSERS;X) THEN FOUND = 0
    
    BEGIN CASE 
    CASE MODE = 'PUSH' 
       IF NOT(FOUND) THEN 
          U.SBUSERS<X> = @USER.ID
          U.DATA(X,1) = @PASS.DEFN
          U.DATA(X,1) = @USERKEYS 
       END 
    
    CASE MODE = 'POP' 
       IF FOUND THEN 
          U.SBUSERS = DEL(U.SBUSERS,X,0,0)
          U.DATA(X,1) = '' ; U.DATA(X,2)='' 
       END 
    
    CASE MODE = 'SWITCH'
       IF NOT(FOUND) THEN CHAIN 'SB.LOGIN ':SBUSER ;* if you known the sbpasswd, use SB.LOGIN sbu,sbpass
       * switch vars
       @USER.ID = U.SBUSERS<X>
       @PASS.DEFN = U.DATA(X,1)
       @USERKEYS = U.DATA(X,2) 
       * switch dmsecurity
       WRITE @SYSID:'-':@USER.ID ON @F.PASS,'$PORT':@PORT 
       WRITE @PASS.DEFN ON @F.PASS,'$PASS':@PORT 
       * switch mainwin title bar 
       TITLE = @PORT:' ':@SYSID :' ':@USER.ID ;* what you want ...
       @CONTROL<2> = TITLE
       ERR=SETATTR(@MAINWIN,G.TITLE,TITLE)
       CHAIN 'MM'
    END CASE 
    
    EXIT 0 
       
    
    ​

    After real LOGIN, call STACKSBU('PUSH',@USER.ID) 
    At real logout, call STACKSBU('POP',@USER.ID) 
    When switch needed, call STACKSBU('SWITCH',newuser)

    about NFC/card reader/tagreader... I'm sure you found a method to launch a control which listen your device  then  send a event to sbserver/UCR which invoke STACKSBU('SWITCH',newuser). 
    I can share a .net control which listen a http/rest request (on client side) then invoke sbserver process.
    You can build a app.exe to interface your device then send the request to the listener control.

    I hope this help 
    manu 





    ------------------------------
    Manu Fernandes
    ------------------------------