Module: Maestrano::SSO::User
- Defined in:
- lib/maestrano/sso/user.rb
Instance Method Summary collapse
- #find_for_maestrano_auth(auth) ⇒ Object
-
#maestrano? ⇒ Boolean
Check whether the user is a maestrano one.
-
#maestrano_session_valid?(session) ⇒ Boolean
Check whether the SSO session is still valid or not.
Instance Method Details
#find_for_maestrano_auth(auth) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/maestrano/sso/user.rb', line 4 def find_for_maestrano_auth(auth) # E.g with Rails # where(auth.slice(:provider, :uid)).first_or_create do |user| # user.provider = auth[:provider] # user.uid = auth[:uid] # user.email = auth[:info][:email] # user.name = auth[:info][:first_name] # user.surname = auth[:info][:last_name] # user.country = auth[:info][:country] # user.company = auth[:info][:company_name] # end raise NoMethodError, "You need to override find_for_maestrano_auth in your #{self.class.name} model" end |
#maestrano? ⇒ Boolean
Check whether the user is a maestrano one
19 20 21 22 23 24 25 |
# File 'lib/maestrano/sso/user.rb', line 19 def maestrano? if self.respond_to?(:provider) return self.provider.to_s == 'maestrano' else raise NoMethodError, "You need to override maestrano? in your #{self.class.name} model" end end |