Class: CASServer::Authenticators::Base
- Inherits:
-
Object
- Object
- CASServer::Authenticators::Base
- Defined in:
- lib/casserver/authenticators/base.rb
Direct Known Subclasses
ActiveResource, ClientCertificate, Google, LDAP, OpenID, SQL, Test
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
-
.setup(options) ⇒ Object
This is called at server startup.
Instance Method Summary collapse
-
#configure(options) ⇒ Object
This is called prior to #validate (i.e. each time the user tries to log in).
- #extra_attributes ⇒ Object
-
#validate(credentials) ⇒ Object
Override this to implement your authentication credential validation.
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/casserver/authenticators/base.rb', line 4 def @options end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/casserver/authenticators/base.rb', line 5 def username @username end |
Class Method Details
.setup(options) ⇒ Object
This is called at server startup. Any class-wide initializiation for the authenticator should be done here. (e.g. establish database connection). You can leave this empty if you don’t need to set up anything.
12 13 |
# File 'lib/casserver/authenticators/base.rb', line 12 def self.setup() end |
Instance Method Details
#configure(options) ⇒ Object
This is called prior to #validate (i.e. each time the user tries to log in). Any per-instance initialization for the authenticator should be done here.
By default this makes the authenticator options hash available for #validate under @options and initializes @extra_attributes to an empty hash.
20 21 22 23 24 |
# File 'lib/casserver/authenticators/base.rb', line 20 def configure() raise ArgumentError, "options must be a HashWithIndifferentAccess" unless .kind_of? HashWithIndifferentAccess @options = .dup @extra_attributes = {} end |
#extra_attributes ⇒ Object
37 38 39 |
# File 'lib/casserver/authenticators/base.rb', line 37 def extra_attributes @extra_attributes end |
#validate(credentials) ⇒ Object
Override this to implement your authentication credential validation. This is called each time the user tries to log in. The credentials hash holds the credentials as entered by the user (generally under :username and :password keys; :service and :request are also included by default)
Note that the standard credentials can be read in to instance variables by calling #read_standard_credentials.
33 34 35 |
# File 'lib/casserver/authenticators/base.rb', line 33 def validate(credentials) raise NotImplementedError, "This method must be implemented by a class extending #{self.class}" end |