Commit e5df0e11208b5af75164fe8df94d1f1bf95b7b88

Authored by Spencer Alan
1 parent 213b9714
Exists in master

add comments for configurations

lib/generators/scim_rails/templates/initializer.rb
1 1 ScimRails.configure do |config|
  2 + # Model used for authenticating and scoping users.
2 3 config.basic_auth_model = "Company"
  4 +
  5 + # Attribute used to search for a given record. This
  6 + # attribute should be unique as it will return the
  7 + # first found record.
  8 + config.basic_auth_model_searchable_attribute = :subdomain
  9 +
  10 + # Attribute used to compare Basic Auth password value.
  11 + # Attribute will need to return plaintext for comparison.
  12 + config.basic_auth_model_authenticatable_attribute = :api_token
  13 +
  14 + # Model used for user records.
3 15 config.scim_users_model = "User"
4   - config.user_attributes = []
  16 +
  17 + # Metod used for retriving user records from the
  18 + # authenticatable model.
  19 + config.scim_users_scope = :users
  20 +
  21 + # Default sort order for pagination is by id. If you
  22 + # use non sequential ids for user records, uncomment
  23 + # the below line and configure a determinate order.
  24 + # For example, [:created_at, :id] or { created_at: :desc }.
  25 + # config.scim_users_list_order = :id
  26 +
  27 + # Method called on user model to deprovision a user.
  28 + config.user_deprovision_method = :archive!
  29 +
  30 + # Method called on user model to reprovision a user.
  31 + config.user_reprovision_method = :unarchive!
  32 +
  33 + # Hash of queryable attribtues on the user model. If
  34 + # the attribute is not listed in this hash it cannot
  35 + # be queried by this Gem. The structure of this hash
  36 + # is { queryable_scim_attribute => user_attribute }.
  37 + config.queryable_user_attributes = {
  38 + userName: :email,
  39 + givenName: :first_name,
  40 + familyName: :last_name,
  41 + email: :email
  42 + }
  43 +
  44 + # Array of attributes that can be modified on the
  45 + # user model. If the attribute is not in this array
  46 + # the attribute cannot be modified by this Gem.
  47 + config.mutable_user_attributes = [
  48 + :first_name,
  49 + :last_name,
  50 + :email
  51 + ]
  52 +
  53 + # Hash of mutable attributes. This object is the map
  54 + # for this Gem to figure out where to look in a SCIM
  55 + # response for mutable values. This object should
  56 + # include all attributes listed in
  57 + # config.mutable_user_attributes.
  58 + config.mutable_user_attributes_schema = {
  59 + name: {
  60 + givenName: :first_name,
  61 + familyName: :last_name
  62 + },
  63 + emails: [
  64 + {
  65 + value: :email
  66 + }
  67 + ]
  68 + }
  69 +
  70 + # Hash of SCIM structure for a user schema. This object
  71 + # is what will be returned for a given user. The keys
  72 + # in this object should conform to standard SCIM
  73 + # structures. The values in the object will be
  74 + # transformed per user record. Strings will be passed
  75 + # through as is, symbols will be passed to the user
  76 + # object to return a value.
  77 + config.user_schema = {
  78 + schemas: ["urn:ietf:params:scim:schemas:core:2.0:User"],
  79 + id: :id,
  80 + userName: :email,
  81 + name: {
  82 + givenName: :first_name,
  83 + familyName: :last_name
  84 + },
  85 + emails: [
  86 + {
  87 + value: :email
  88 + },
  89 + ],
  90 + active: :active?
  91 + }
5 92 end
... ...