Module: Pathway::Plugins::SimpleAuth::InstanceMethods

Defined in:
lib/pathway/plugins/simple_auth.rb

Instance Method Summary collapse

Instance Method Details

#authorize(state, using: nil) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/pathway/plugins/simple_auth.rb', line 15

def authorize(state, using: nil)
  auth_state = if using.is_a?(Array)
                 authorize_with(*state.values_at(*using))
               else
                 authorize_with(state[using || result_key])
               end

  auth_state.then { state }
end

#authorize_with(*objs) ⇒ Object



25
26
27
# File 'lib/pathway/plugins/simple_auth.rb', line 25

def authorize_with(*objs)
  authorized?(*objs) ? wrap(objs) : error(:forbidden)
end

#authorized?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/pathway/plugins/simple_auth.rb', line 29

def authorized?(*)
  true
end