ruby-on-rails-3ldaprubycas

rubycas-server response


This is the data that I get back from the rubycas server.

{
  "cn"=>"--- - Toby Joiner", 
  "sn"=>"--- - Joiner", 
  "mail"=>"--- - tobyjoiner@xxxxxx.xxx", 
  "memberof"=>"--- 
      - CN=All Users,OU=AllUsers,DC=bnw,DC=local
      - CN=Administrators,CN=Builtin,DC=bnw,DC=local 
      - CN=Remote Desktop Users,CN=Builtin,DC=bnw,DC=local", 
  "givenname"=>"--- - Toby"
}

I am wondering if there is a way I am supposed pull this data out, right now I am doing:

first_name = session[:cas_extra_attributes][:sn].gsub('-','')

to remove the dashes. I am hoping I am just missing the built in way to get the extra data out from the rubycas server.


Solution

  • That looks like YAML escaped data. You should be able to get rid of it by first parsing it through YAML.load and then processing it as you wish.


    As a small aside, I've personally re-implemented the basic functions of rubycas-server as a Rails engine called cassy. However, I don't think it supports sending through extra attributes at the moment.

    I just thought I'd mention it as it gives you an alternative to try if rubycas-server doesn't work out.