class HaveAPI::Fs::Auth::Base
Base
class for all authentication methods.
Public Class Methods
method_name()
click to toggle source
# File lib/haveapi/fs/auth/base.rb, line 4 def self.method_name @method_name end
new(cfg, opts)
click to toggle source
@param [Hash] cfg server config @param [Hash] opts mount options
# File lib/haveapi/fs/auth/base.rb, line 23 def initialize(cfg, opts) @cfg = cfg @opts = opts setup end
register(name)
click to toggle source
All authentication providers must register using this method. @param [Symbol] name
# File lib/haveapi/fs/auth/base.rb, line 10 def self.register(name) HaveAPI::Fs.register_auth(name, self) @method_name = name end
use?(opts)
click to toggle source
Check if this authentication provider should be used based on `opts`. @param [Hash] opts mount options
# File lib/haveapi/fs/auth/base.rb, line 17 def self.use?(opts) false end
Public Instance Methods
authenticate(client)
click to toggle source
Authenticate the `client` object @param [HaveAPI::Client::Client] client
# File lib/haveapi/fs/auth/base.rb, line 47 def authenticate(client) end
check(client)
click to toggle source
Check whether the authentication works by running some real API request.
# File lib/haveapi/fs/auth/base.rb, line 52 def check(client) client.user.current end
name()
click to toggle source
# File lib/haveapi/fs/auth/base.rb, line 35 def name self.class.method_name end
setup()
click to toggle source
Called right after {#initialize}.
# File lib/haveapi/fs/auth/base.rb, line 31 def setup end
validate()
click to toggle source
In this method, the provider should check if it has all needed information. Missing pieces can be queried from the user on stdin.
# File lib/haveapi/fs/auth/base.rb, line 41 def validate end