Skip to content

Commit

Permalink
Merge 585634b into 7bbf60a
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Hall committed May 7, 2015
2 parents 7bbf60a + 585634b commit 17621d8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -11,9 +11,12 @@ To use the test authenticator, configure it in your cas.yml:
authenticators:
test_authenticator:
authenticator: "Test"
options:
options: # All the options are optional
mail: true # If true will return a mail attribute containing a fake e-mail address for the user
extra_attributes: # Can contain whatever values you want
foo: 'value'
bar: 'value'

The only option is "mail" which will return a mail attribute containg a fake e-mail address for the user.

## Contributing to casino-test_authenticator

Expand Down
1 change: 1 addition & 0 deletions lib/casino/test_authenticator.rb
Expand Up @@ -28,6 +28,7 @@ def generate_user

def extra_attributes
attr = {}
attr = @options[:extra_attributes] if @options[:extra_attributes].is_a?(Hash)
attr[:mail] = Faker::Internet.email if @options[:mail]
attr.length == 0 ? nil : attr
end
Expand Down
11 changes: 11 additions & 0 deletions spec/casino/test_authenticator_spec.rb
Expand Up @@ -38,5 +38,16 @@
end
end

context 'when extra_attributes are given' do
let (:options) { { extra_attributes: { first_name: 'Clark', last_name: 'Kent' } } }
let (:password) { 'test' }
it 'returns the extra_attributes' do
res = subject.validate(username, password)
res.should have_key(:extra_attributes)
res[:extra_attributes][:first_name].should eql('Clark')
res[:extra_attributes][:last_name].should eql('Kent')
end
end

end
end

0 comments on commit 17621d8

Please sign in to comment.