Hello,
We have Client-Server applications where we want the users log in with their Active Directory account. How can we validate username and password against Active Directory? We are using PowerBuilder 2017 R2.
Hello,
We have Client-Server applications where we want the users log in with their Active Directory account. How can we validate username and password against Active Directory? We are using PowerBuilder 2017 R2.
For Oracle users, this might be a helpful link:
https://docs.oracle.com/cd/B28359_01/win.111/b32010/authen.htm#i1006045
Many traditional client/server apps require DB login at startup. Example here asks database for user's identity right after DB connect.
SQLCA.DBMS = "SNC"
SQLCA.ServerName = "DemoServer"
SQLCA.DBParm = "Database='DemoDB',Provider='SQLNCLI11',TrustedConnection=1"
CONNECT USING SQLCA;
SELECT ADLogin INTO :ls_loginName
FROM (SELECT ORIGINAL_LOGIN() [ADLogin]) a
USING SQLCA;
TIPS:
HTH /Michael
You can use Visual Guard, to let users log in with their Active Directory account.
Once plugged into the PowerBuilder app, it offers 2 options:
1. Single Sign-On (users don't have to enter credentials - they are automatically logged with the current Windows account)
if isvalid(guo_vgmanager) Then
if guo_vgmanager.of_VerifyUser() > 0 Then
Open(w_Main)
Else
Return
End if
End if
2. Users enter their credentials - this can work even if they are not running the app in the AD domain
if isvalid(guo_vgmanager) Then
if guo_vgmanager.of_VerifyUser(VGlogin, VGpassword, vg_n_authenticationmode.windowsbycredential) > 0 Then
Open(w_Main)
Else
Return
End if
End if
Beside user log in, you can pick additional security features (Permissions Management, Security Audit, Administration Console, etc.).
Regards,
Christophe
Try something like this -
Declare an external function
function long LogonUser(string username, string domain, string password, long logontype, long logonprovider, ref ulong hToken) library "Advapi32" alias for "LogonUserA;Ansi"
And Validate like this;
Constant long LOGON32_LOGON_NETWORK = 3
Constant long LOGON32_PROVIDER_DEFAULT = 0
long ll_rc
ulong ulHandle
ll_rc = LogonUser( sle_user_id.text , sle_domain.text , sle_password.text , LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, ulHandle)
Messagebox( "LogonUser", "Return=" + string(ll_rc) )
if ll_rc > 0 then
CloseHandle(ulHandle)
else
ll_rc = GetLasterror( )
Messagebox( "LogonUser", "GetLastError Return=" + string(ll_rc) )
end if
Hi Bryan;
I did a presentation on A.D. processing from PowerBuilder and PowerServer at the Elevate 2018 conference.
HTH
Regards ... Chris