cas_server.auth module¶
Some authentication classes for the CAS
-
class
cas_server.auth.AuthUser(username)[source]¶ Bases:
objectAuthentication base class
Parameters: username (unicode) – A username, stored in the usernameclass attribute.-
username= None¶ username used to instanciate the current object
-
-
class
cas_server.auth.DummyAuthUser(username)[source]¶ Bases:
cas_server.auth.AuthUserA Dummy authentication class. Authentication always fails
Parameters: username (unicode) – A username, stored in the usernameclass attribute. There is no valid value for this attribute here.
-
class
cas_server.auth.TestAuthUser(username)[source]¶ Bases:
cas_server.auth.AuthUserA test authentication class only working for one unique user.
Parameters: username (unicode) – A username, stored in the usernameclass attribute. The uniq valid value issettings.CAS_TEST_USER.
-
class
cas_server.auth.DBAuthUser(username)[source]¶ Bases:
cas_server.auth.AuthUserbase class for databate based auth classes
-
user= None¶ DB user attributes as a
dictif the username is found in the database.
-
-
class
cas_server.auth.MysqlAuthUser(username)[source]¶ Bases:
cas_server.auth.DBAuthUserDEPRECATED, use
SqlAuthUserinstead.A mysql authentication class: authenticate user against a mysql database
Parameters: username (unicode) – A username, stored in the usernameclass 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.DBAuthUserA SQL authentication class: authenticate user against 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 usernameclass 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.DBAuthUserA ldap authentication class: authenticate user against a ldap database
Parameters: username (unicode) – A username, stored in the usernameclass attribute. Valid value are fetched from the ldap database set withsettings.CAS_LDAP_*settings parameters.-
test_password(password)[source]¶ Tests
passwordagainst the user-supplied password.Parameters: password (unicode) – a clear text password as submited by the user. Returns: Trueifusernameis valid andpasswordis correct,Falseotherwise.Return type: bool
-
attributs()[source]¶ The user attributes.
Returns: a dictwith the user attributes. Attributes may beunicode()orlistofunicode(). If the user do not exists, the returneddictis empty.Return type: dict Raises: NotImplementedError – if the password check method in CAS_LDAP_PASSWORD_CHECK do not allow to fetch the attributes without the user credentials.
-
-
class
cas_server.auth.DjangoAuthUser(username)[source]¶ Bases:
cas_server.auth.AuthUserA django auth class: authenticate user against django internal users
Parameters: username (unicode) – A username, stored in the usernameclass 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.AuthUserAuthentication class used then CAS_FEDERATE is True
Parameters: username (unicode) – A username, stored in the usernameclass attribute. Valid value are usernames ofFederatedUserobject.FederatedUserobject are created on CAS backends successful ticket validation.-
user= None¶ a :class`FederatedUser<cas_server.models.FederatedUser>` object if
usernameis found.
-
test_password(ticket)[source]¶ Tests
passwordagainst the user-supplied password.Parameters: password (unicode) – The CAS tickets just used to validate the user authentication against its CAS backend. Returns: Trueifuseris valid andpasswordis a ticket validated less thansettings.CAS_TICKET_VALIDITYsecondes and has not being previously used for authenticated thisFederatedUser.Falseotherwise.Return type: bool
-