1

Railsアプリでldap_devise_authenticatableを使用しようとしています。https://github.com/cschiewek/devise_ldap_authenticatableおよびhttp://random-rails.blogspot.com/2010/07/ldap-authentication-with-devise.htmlを参照しています。

現在、使用しているldapサーバーにldap.ymlファイルを構成する際に問題が発生しています。どのパラメータにどのような詳細を正確に入力するかを理解するのが難しいことに直面しています。

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

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

Enviromentsに入力するパラメーター値についてはある程度わかっていますが、Authorization関連のパラメーターに入力する詳細については空白のようです。以下に示す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..

助けてくれてありがとう。

4

1 に答える 1

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/ master / test / rails_app / config / ldap_with_uid.yml https://github.com/cschiewek/devise_ldap_authenticatable/blob/master/test/rails_app/config/ldap_with_erb.yml

また、<<:* AUTHORIZATIONSのものについてあまり混乱しないでください。環境ごとに同じ変数を含めるのは、単なるyamlショートカットです。すぐに、権限ブロック全体をコピーして各環境に貼り付けることができます。

于 2011-02-17T18:33:32.783 に答える