cas_server.auth module¶
Some authentication classes for the CAS
-
class
cas_server.auth.
AuthUser
(username)[source]¶ Bases:
object
Authentication base class
Parameters: username (unicode) – A username, stored in the username
class attribute.-
username
= None¶ username used to instanciate the current object
-
-
class
cas_server.auth.
DummyAuthUser
(username)[source]¶ Bases:
cas_server.auth.AuthUser
A Dummy authentication class. Authentication always fails
Parameters: username (unicode) – A username, stored in the username
class attribute. There is no valid value for this attribute here.
-
class
cas_server.auth.
TestAuthUser
(username)[source]¶ Bases:
cas_server.auth.AuthUser
A test authentication class only working for one unique user.
Parameters: username (unicode) – A username, stored in the username
class attribute. The uniq valid value issettings.CAS_TEST_USER
.
-
class
cas_server.auth.
DBAuthUser
(username)[source]¶ Bases:
cas_server.auth.AuthUser
base class for databate based auth classes
-
class
cas_server.auth.
MysqlAuthUser
(username)[source]¶ Bases:
cas_server.auth.DBAuthUser
DEPRECATED, use
SqlAuthUser
instead.A mysql authentication class: authenticate user agains a mysql database
Parameters: username (unicode) – A username, stored in the username
class attribute. Valid value are fetched from the MySQL database set withsettings.CAS_SQL_*
settings parameters using the querysettings.CAS_SQL_USER_QUERY
.
-
class
cas_server.auth.
SqlAuthUser
(username)[source]¶ Bases:
cas_server.auth.DBAuthUser
A SQL authentication class: authenticate user agains a SQL database. The SQL database must be configures in settings.py as
settings.DATABASES['cas_server']
.Parameters: username (unicode) – A username, stored in the username
class attribute. Valid value are fetched from the MySQL database set withsettings.CAS_SQL_*
settings parameters using the querysettings.CAS_SQL_USER_QUERY
.
-
class
cas_server.auth.
LdapAuthUser
(username)[source]¶ Bases:
cas_server.auth.DBAuthUser
A ldap authentication class: authenticate user against a ldap database
Parameters: username (unicode) – A username, stored in the username
class attribute. Valid value are fetched from the ldap database set withsettings.CAS_LDAP_*
settings parameters.
-
class
cas_server.auth.
DjangoAuthUser
(username)[source]¶ Bases:
cas_server.auth.AuthUser
A django auth class: authenticate user against django internal users
Parameters: username (unicode) – A username, stored in the username
class attribute. Valid value are usernames of django internal users.-
user
= None¶ a django user object if the username is found. The user model is retreived using
django.contrib.auth.get_user_model()
.
-
-
class
cas_server.auth.
CASFederateAuth
(username)[source]¶ Bases:
cas_server.auth.AuthUser
Authentication class used then CAS_FEDERATE is True
Parameters: username (unicode) – A username, stored in the username
class attribute. Valid value are usernames ofFederatedUser
object.FederatedUser
object are created on CAS backends successful ticket validation.-
user
= None¶ a :class`FederatedUser<cas_server.models.FederatedUser>` object if
username
is found.
-
test_password
(ticket)[source]¶ Tests
password
agains the user password.Parameters: password (unicode) – The CAS tickets just used to validate the user authentication against its CAS backend. Returns: True
ifuser
is valid andpassword
is a ticket validated less thansettings.CAS_TICKET_VALIDITY
secondes and has not being previously used for authenticated thisFederatedUser
.False
otherwise.Return type: bool
-