Sha256: 4b2ad0b126e4b6a84e5897cd2f068dce9bcbc987483221275e02199fc868ece2

Contents?: true

Size: 1.55 KB

Versions: 33

Compression:

Stored size: 1.55 KB

Contents

require 'casserver/authenticators/base'

# NOT YET IMPLEMENTED
#
# This authenticator will authenticate the user based on a client SSL certificate.
#
# You will probably want to use this along with another authenticator, chaining
# it so that if the client does not provide a certificate, the server can
# fall back to some other authentication mechanism.
#
# Here's an example of how to use two chained authenticators in the config.yml
# file. The server will first use the ClientCertificate authenticator, and
# only fall back to the SQL authenticator of the first one fails:
#
# authenticator:
#  -
#    class: CASServer::Authenticators::ClientCertificate
#  -
#    class: CASServer::Authenticators::SQL
#    database:
#      adapter: mysql
#      database: some_database_with_users_table
#      user: root
#      password:
#      server: localhost
#    user_table: user
#    username_column: username
#    password_column: password
#
class CASServer::Authenticators::ClientCertificate < CASServer::Authenticators::Base
  def validate(credentials)
    read_standard_credentials(credentials)

    @client_cert = credentials[:request]['SSL_CLIENT_CERT']

    # note that I haven't actually tested to see if SSL_CLIENT_CERT gets
    # filled with data when a client cert is provided, but this should be
    # the case at least in theory :)

    return false if @client_cert.blank?

    # IMPLEMENT SSL CERTIFICATE VALIDATION CODE HERE
    raise NotImplementedError, "#{self.class.name}#validate NOT YET IMPLEMENTED!"

    return true # if SSL certificate is valid, false otherwise
  end
end

Version data entries

33 entries across 33 versions & 6 rubygems

Version Path
synapse-rubycas-server-1.1.6 lib/casserver/authenticators/client_certificate.rb
synapse-rubycas-server-1.1.5.pre lib/casserver/authenticators/client_certificate.rb
synapse-rubycas-server-1.1.4.pre lib/casserver/authenticators/client_certificate.rb
synapse-rubycas-server-1.1.4 lib/casserver/authenticators/client_certificate.rb
synapse-rubycas-server-1.1.3alpha lib/casserver/authenticators/client_certificate.rb
synapse-rubycas-server-1.1.3.pre lib/casserver/authenticators/client_certificate.rb
synapses-cas-0.1.11 lib/casserver/authenticators/client_certificate.rb
synapses-cas-0.1.10 lib/casserver/authenticators/client_certificate.rb
synapses-cas-0.1.9 lib/casserver/authenticators/client_certificate.rb
ror-rubycas-server-1.0.c lib/casserver/authenticators/client_certificate.rb
ror-rubycas-server-1.0.b lib/casserver/authenticators/client_certificate.rb
ror-rubycas-server-1.0.a lib/casserver/authenticators/client_certificate.rb
rubycas-server-1.1.2 lib/casserver/authenticators/client_certificate.rb
synapses-cas-0.1.8 lib/casserver/authenticators/client_certificate.rb
synapses-cas-0.1.7 lib/casserver/authenticators/client_certificate.rb
rubycas-server-1.1.1 lib/casserver/authenticators/client_certificate.rb
synapses-cas-0.1.6 lib/casserver/authenticators/client_certificate.rb
synapses-cas-0.1.5 lib/casserver/authenticators/client_certificate.rb
synapses-cas-0.1.4 lib/casserver/authenticators/client_certificate.rb
synapses-cas-0.1.3 lib/casserver/authenticators/client_certificate.rb