Two SQLEncrypted authenticators don't make friends

34 views
Skip to first unread message

Dziamid Zayankouski

unread,
Jul 15, 2013, 10:34:07 AM7/15/13
to rubycas...@googlegroups.com
Hello!
I am trying to setup 2 authenticators:

authenticator:
  -
    class: CASServer::Authenticators::SQLEncrypted
    database:
      adapter: mysql2
      database: db1
      username: root
      password: root
      host: localhost
    user_table: sf_guard_user
    username_column: email_address
  -
    class: CASServer::Authenticators::SQLEncrypted
    database:
      adapter: mysql2
      database: db2
      username: root
      password: root
      host: localhost
    user_table: user
    username_column: email

I fails with miserable error:
Mysql2::Error: Unknown column 'email_address' in 'where clause': SELECT `user`.* FROM `user`  WHERE (email_address = 'b...@bla.com')

I seems like ActiveRecord is building wrong query. There's in fact no "email_address" in table "user" (db2 authenticator).

If you comment any of these, it works. CAS works with one or the other, but not with both. What can be the problem? Seems like a bug.



Robert Mitwicki

unread,
Jul 15, 2013, 11:07:01 AM7/15/13
to rubycas...@googlegroups.com
Hi Dziamid,

Which branch and version are you using?

Could you try to reproduce that on my private branch "my_master" which you can find here: github.com/mitfik/rubycas-server .

I improved few things related with multiple authenticators support but didn't had time to merge that into main branch.

Best regards





--
You received this message because you are subscribed to the Google Groups "RubyCAS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubycas-serve...@googlegroups.com.
To post to this group, send email to rubycas...@googlegroups.com.
Visit this group at http://groups.google.com/group/rubycas-server.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Robert Mitwicki
Senior Software Engineer
FXI Technologies

Robert Mitwicki

unread,
Jul 15, 2013, 11:10:50 AM7/15/13
to rubycas...@googlegroups.com
I am almost sure that in the official release multiple authenticators works only for different types.
If you have the same type of authenticator it can fail.
I think this was the main reason why I started to reimplementing this feature as I wanted to use two LDAP authenticators.

But I'm not 100% sure :)
As soon as I will find some time I will take a look on that.

br

Dziamid Zayankouski

unread,
Jul 15, 2013, 11:49:01 AM7/15/13
to rubycas...@googlegroups.com
Thanks for your reply, I will have a look at it.

Dziamid Zayankouski

unread,
Jul 16, 2013, 5:11:11 AM7/16/13
to rubycas...@googlegroups.com
I am trying to get up your branch (my_master) working, but cannot get through this error:

Problem to establish connection to database. Check if is correct configured (RuntimeError)
I am using mysql2 adapter and I have added mysql2 gem to my Gemfile and have run bundle.

Robert Mitwicki

unread,
Jul 17, 2013, 4:00:49 AM7/17/13
to rubycas...@googlegroups.com
Hi,

The problem is with the mysql2 adapter
Just try in your Gemfile:

gem 'mysql2', '< 0.3'

With this one I was able to run rubycas-server without problem.
Later on I will try to figure out why this problem occurs.

Best regards

Dziamid Zayankouski

unread,
Jul 19, 2013, 9:15:54 AM7/19/13
to rubycas...@googlegroups.com
Hi, I finally got your branch working. I did a little research and found out that config.yml file location has changed from root to config dir now.
However, the problem with several authenticators still remains. For now, I fixed that by ensuring both tables have identical username field name. I am sure it is a minor fix, but I am not a ruby guy to debug it.
Thank you for your support anyway.
Reply all
Reply to author
Forward
0 new messages