XF 2 I'm looking for a auth solution. PAID

Seeker-Smith

Active member
I have xenforo 2.2 on a hosted server, I also have a remote portal that connects via remote mysql. Apache is using this remote connection to provide basic auth.

I need to update this connection from vb4 users > portal to xenforo xf_user, xf_user_authenticate > portal. The Apache mod is authn_dbd. Basically I need someone to write the sql for this connection. (It looks something like below) authn_dbd is bcrypt capable and my understanding is I should be able to get the username and password from the xf_user, xf_user_authenticate tables. I just don't know how to write the sql.

DBDParams "db_xenforo"
<Directory /media/data/www/portal.>
AuthName "You Must Login"
AuthType Basic
AuthBasicProvider dbd
AuthBasicProvider socache dbd
AuthnCacheProvideFor dbd
AuthnCacheContext my-server

AuthDBDUserPWQuery "SELECT encrypt(password) AS password FROM password WHERE username = %s"
Require valid-user
</Directory>
 

Mythotical

Well-known member
Not sure this will work as it's untested.
Code:
 SELECT decrypt (password) AS password FROM xf_user WHERE username = %s[code]

Let me know if this works for you or not.
 

Seeker-Smith

Active member
Not sure this will work as it's untested.
Code:
 SELECT decrypt (password) AS password FROM xf_user WHERE username = %s[code]

Let me know if this works for you or not.
Thanks for the reply. This is what I came up. I'm sure a xenforo pro could improve it.

AuthDBDUserPWQuery "select substring(data, 23, length(data) - 25) from xf_user_authenticate xua join xf_user xu on xua.user_id = xu.user_id where xu.username = %s AND xua.scheme_class = 'XF:Core12'"
Require dbd-group allowed
AuthzDBDQuery "select 'allowed' from xf_user where (find_in_set('3', secondary_group_ids) OR find_in_set('4', secondary_group_ids) OR find_in_set('47', secondary_group_ids) OR find_in_set('49', secondary_group_ids) OR find_in_set('50', secondary_group_ids)) AND username = %s"
 
Top