ruby - cas的相关问题:single sign out, 与gate way

访问量: 143

cas 服务器端:

https://github.com/rubycas/rubycas-server/  (内容多)

文档都在代码里.wiki中也有很多. 配置文档见 config.example.yml

这里也有配置:https://github.com/rubycas/rubycas-server/wiki/Installation

这里说了gateway的用法:https://github.com/rubycas/rubycas-server/wiki/Usage-Scenarios

客户端:

分成2个,古老的:https://github.com/rubycas/rubycas-client  (比较多)

https://github.com/rubycas/rubycas-client-rails  ( 几乎没内容)

新兴客户端:

https://github.com/biola/rack-cas

使用single sign out步骤:

1. Gemfile

2. config/environment.rb  

# 记得touch 这个文件
cas_logger = CASClient::Logger.new(Rails.root.join('log', 'cas.log'))
cas_logger.level = Logger::DEBUG

CASClient::Frameworks::Rails::Filter.configure(
  :cas_base_url => ENV['CAS_SERVER'],
  :username_session_key => :cas_user,
  :logger => cas_logger,
  :enable_single_sign_out => true
)

3. config/application.rb

0     # 给cas sso 使用

 42     config.action_controller.allow_forgery_protection = false

4 .对于rails 4.2 无法使用session_store ,参考: https://github.com/rails/activerecord-session_store

rails generate active_record:session_migration
bundle exec rake db:migrate

5. 为/config/initializers/session_store.rb

Rails.application.config.session_store :active_record_store, :key => '_cadae_session'

6. 为logger打个补丁

# config/initializers/log4r_patch.rb
class Log4r::Logger
  def formatter()
  end
end

Log4r::Logger.send :include, ActiveRecord::SessionStore::Extension::LoggerSilencer

7. Gemfile:

gem 'activerecord-session_store', '1.1.3'

8. 

$ mkdir tmp/sessions

Gateway 

为对应的controller 增加:

before_filter CASClient::Frameworks::Rails::GatewayFilter, :only => :index 

订阅/RSS Feed

Subscribe

分类/category