project BLF > class Session > method ValidateLogin

Description

This method is used e.g. in BBaseDaemon, to check if the userlogin and password is valid.


Parameters


icUsrLogininputcharacter
icUsrPasswordinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BBaseDaemon.ValidateComponent
method BSystem.ValidateComponent


program code (program1/session.p)

If vcUserFromUIShell = '':U Or
   vcUserFromUIShell = ?
Then Do:
    if com.qad.qra.config.QraConfig:IsEnabled
    then do:
        <I-64 {bFcStartAndOpenInstance
             &CLASS                = "PAuthenticationQRA"}>
        
        /* ignore the returned client-principal object */
        <M-44 run AuthenticateWrapper
           (input  icUsrLogin (icLogin), 
            input  icUsrPassword (icPassword), 
            output vcTempGlobalSessionId (ocGlobalSessionId), 
            output vcCPO (ocClientPrincipalObject), 
            output viFcReturnSuper (oiReturnStatus)) in PAuthenticationQRA>
    
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then Do:
            <I-94 {bFcCloseAndStopInstance
                 &CLASS           = "PAuthenticationQRA"}>
            return.
        End.
        
        Create tLogoutSessionTokenCaller.
        Assign tLogoutSessionTokenCaller.tcMfgSessionId = vcTempGlobalSessionId.
        
        <M-63 run Logout
           (input  tLogoutSessionTokenCaller (tLogoutSessionToken), 
            output tResponseCodeCaller (tResponseCode), 
            output viFcReturnSuper (oiReturnStatus)) in PAuthenticationQRA>
        
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then Do:
            <I-5 {bFcCloseAndStopInstance
                 &CLASS           = "PAuthenticationQRA"}>
            return.
        End.
        
        For Each tResponseCodeCaller Where
                 tResponseCodeCaller.tcResponseCode <> '0':U:
            assign vcMsg = <M-83 GetMessage  (input  tResponseCodeCaller.tcResponseCode (icErrorCode)) in PAuthenticationQRA>
                   oiReturnStatus = -1.           
            <M-70 run SetMessage
               (input  vcMsg (icMessage), 
                input  '' (icArguments), 
                input  '' (icFieldName), 
                input  '' (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '' (icRowid), 
                input  'blf-558944':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in Session>
        End. /*For Each tControlFlagsCall:*/
    
        <I-38 {bFcCloseAndStopInstance
             &CLASS           = "PAuthenticationQRA"}>    
        
    end.
    else do:

        <I-1 {bFcStartAndOpenInstance
                &CLASS              = "PAuthentication"}>
        
        /* ignore the returned client-principal object */
        <M-2 run AuthenticateWrapper
           (input  icUsrLogin (icLogin), 
            input  icUsrPassword (icPassword), 
            output vcTempGlobalSessionId (ocGlobalSessionId), 
            output vcCPO (ocClientPrincipalObject), 
            output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
    
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then Do:
            <I-28 {bFcCloseAndStopInstance
                &CLASS           = "PAuthentication"}>
            return.
        End.
        
        Create tLogoutSessionTokenCaller.
        Assign tLogoutSessionTokenCaller.tcMfgSessionId = vcTempGlobalSessionId.
        
        <M-24 run Logout
           (input  tLogoutSessionTokenCaller (tLogoutSessionToken), 
            output tResponseCodeCaller (tResponseCode), 
            output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
        
        if viFcReturnSuper <> 0
        then oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then Do:
            <I-25 {bFcCloseAndStopInstance
                &CLASS           = "PAuthentication"}>
            return.
        End.
        
        For Each tResponseCodeCaller Where
                 tResponseCodeCaller.tcResponseCode <> '0':U:
            assign vcMsg = <M-26 GetMessage
                              (input  tResponseCodeCaller.tcResponseCode (icErrorCode)) in PAuthentication>
                   oiReturnStatus = -1.           
            <M-27 run SetMessage
               (input  vcMsg (icMessage), 
                input  '' (icArguments), 
                input  '' (icFieldName), 
                input  '' (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '' (icRowid), 
                input  'BLF-413':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in Session>
        End. /*For Each tControlFlagsCall:*/
    
        <I-3 {bFcCloseAndStopInstance
                &CLASS           = "PAuthentication"}>    
    
    end. /* if vlQRA */
    
End. /*If vcUserFromUIShell = '':U Or*/