2011-02-17 2 views
1

私は自分のレールアプリでldap_devise_authenticatableを使用しようとしています。私はhttps://github.com/cschiewek/devise_ldap_authenticatablehttp://random-rails.blogspot.com/2010/07/ldap-authentication-with-devise.htmlを指しています。Ldap_devise_authenticatable gemのldap.ymlの使用

私は現在、使用しているLDAPサーバーにldap.ymlファイルを設定する際に問題に直面しています。私はどのパラメータをどのような細部で満たしているのかを理解するのが難しいということに直面しています。

http://net-ldap.rubyforge.org/classes/Net/LDAP.htmlからいくつかの情報を集めることができました。しかし、このチュートリアルは主にnet-ldap gemのためのものです。それは私の目的を完全に果たすものではありません。

私はLDAP上の良いチュートリアルを教えてください...私はldap.ymlに値として記入する必要があるパラメータに固有のものです。私は認証と環境の両方に使用しています。私が持っていた重要な疑問は

私は環境にどのようなパラメータ値を入力するべきか考えていますが、認証に関連するパラメータを入力するための詳細は空白です。私は、下記のldap.ymlで疑問を埋めるための詳細についてはほとんどコメントしていません。実現可能であれば、私に助けてください。

私の現在のldap.ymlは次のようになります - おそらく見てみるのは良い例は宝石の中のテストですあなたは助けるため

# Authorizations 
# Uncomment out the merging for each enviornment that you'd like to include. 
# You can also just copy and paste the tree (do not include the "authorizations") to each 
# enviornment if you need something different per enviornment. 
authorizations: &AUTHORIZATIONS 
    group_base: ou=groups,dc=test,dc=com 
    ## Requires config.ldap_check_group_membership in devise.rb be true 
    # Can have multiple values, must match all to be authorized 
    required_groups: 
    # If only a group name is given, membership will be checked against "uniqueMember" 
    - cn=admins,ou=groups,dc=test,dc=com 
    - cn=users,ou=groups,dc=test,dc=com 
    # If an array is given, the first element will be the attribute to check against, the second the group name 
    - ["moreMembers", "cn=users,ou=groups,dc=test,dc=com"] 
    ## Requires config.ldap_check_attributes in devise.rb to be true 
    ## Can have multiple attributes and values, must match all to be authorized 
    require_attribute: 
    objectClass: inetOrgPerson 
    authorizationRole: postsAdmin 


## Enviornments 


development: 
    host: # ip address is to be filled in here.. 
    port: # port number goes here.. 
    attribute: cn # what does attribute and cn signify?? what are the other things I can fill attribute with like uid, and..what else ?? 
    base: # my tree base details go in here.. 
    admin_user: cn=admin_name,dc=test,dc=com # do I need to enter the domain component also ? or just the admin_name would do? 
    admin_password: # password goes in here.. 
    ssl: true # when would I be using this..?? 
    # <<: *AUTHORIZATIONS - how & where can I use this..?? 

test: 
    host: # ip address is to be filled in here.. 
    port: # port number goes here.. 
    attribute: cn # what does attribute and cn signify?? what are the other things I can fill attribute with like uid, and..what else ?? 
    base: # my tree base details go in here.. 
    admin_user: cn=admin_name,dc=test,dc=com 
    admin_password: # password goes in here.. 
    ssl: true 
    # <<: *AUTHORIZATIONS - how can I use this.. 

production: 
    host: # ip address is to be filled in here.. 
    port: # port number goes here.. 
    attribute: cn # what does attribute and cn signify?? what are the other things I can fill attribute with like uid, and..what else ?? 
    base: # my tree base details go in here.. 
    admin_user: cn=admin_name,dc=test,dc=com 
    admin_password: # password goes in here.. 
    ssl: true 
    # <<: *AUTHORIZATIONS - how can I use this.. 

おかげ..

答えて

0

。私はそれが全体のサンプルレールのアプリとしたテストをすることができた唯一の方法..

あなたはgithubの上で見ることができますいくつかの例があります。 https://github.com/cschiewek/devise_ldap_authenticatable/blob/master/test/rails_app/config/ldap.yml がhttps://github.com/cschiewek/devise_ldap_authenticatable/blob/マスター/テスト/ rails_app /設定/ ldap_with_uid.yml https://github.com/cschiewek/devise_ldap_authenticatable/blob/master/test/rails_app/config/ldap_with_erb.yml

また、< <についてあまりにも混乱していけない:*ものを権限、それはあなたが同じようにできた、それぞれの環境で同じ変数を含めるだけでYAMLのショートカットですすぐにすべての権限ブロックをコピーしてそれぞれに貼り付けます。

+0

こんにちはダニエル、あなたの答えをありがとう、私はあなたに別のものを尋ねたかったdevise 1.1.3でldap_devise_authenticatable宝石を使用することができますか?、私はセキュリティの問題のためにこの宝石を使用するアプリを利用しています。そのアプリのLDAP。いくつかのキュウリのテストがダウングレードで失敗しているので私のデヴァイス宝石を1.1.3から1.1.2にダウングレードするのは難しいでしょう(私は私のGemfileでバージョンを変更することに影響を見るために試しました)。 Danielに感謝します。 – boddhisattva

+0

私はdeviseの新しいバージョンをリリースしているので、実際に更新を続ける時間はあまりありませんでしたが、Rakefileをgemspec.add_runtime_dependency "devise"、 "〜> 1.1.2"のように更新してからrake build 。しかし、1.1.3では何も変更していないことを保証することはできません。 –

+0

こんにちはダン、これを試していただきありがとうございます。私は何か問題に直面したときにあなたに戻ります。私は右のアプリケーションに固有のRakeファイルでこれを行うことができます..? – boddhisattva

関連する問題