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



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

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



23
24
25
# File 'lib/pathway/plugins/simple_auth.rb', line 23

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

#authorized?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/pathway/plugins/simple_auth.rb', line 27

def authorized?(*)
  true
end