The Fedora Account System has a JSON interface that we make use of to authenticate users in our web apps. Currently, there are two modes of operation. Some web apps have single sign-on capability with Fedora Account System. These are the TurboGears applications that use the jsonfasprovider. Other apps do not have single sign-on but they do connect to Fedora Account System to verify the username and password so changing the password in Fedora Account System changes it everywhere.
An identity provider with CSRF protection.
This will install as a TurboGears identity plugin. To use it, set the following in your APPNAME/config/app.cfg file:
identity.provider='jsonfas2'
visit.manager='jsonfas2'
See also
This plugin provides authentication by integrating with the Fedora Account System using JSON calls.
Module author: Toshio Kuratomi <tkuratom@redhat.com>
Module author: Ricky Zhou <ricky@fedoraproject.org>
Associate an identity with a person in the auth system.
Return True if not logged in.
Get the csrf token for this identity
Return the user’s display name.
Warning
This is not a TG standard attribute. Don’t use this if you want to be compatible with other identity providers.
Get set of group IDs of this identity.
Return the groups that a user is a member of.
Send a request so that we associate the visit_cookie with the user
Parameters: | using_ssl – Boolean that tells whether ssl was used to authenticate |
---|
Get the URL for the login page.
Remove the link between this identity and the visit.
In one specific instance in the login template we need to know whether an anonymous user is just lacking a token.
Get set of permission names of this identity.
Make an HTTP Request to a server method.
We need to override the send_request provided by BaseClient to keep the visit_key in sync.
Get user instance for this identity.
Get user id of this identity.
Get user name of this identity.
IdentityProvider that authenticates users against the fedora account system
Returns an anonymous user object
Returns: | an object with the following properties: :user_name: original user name :user: a provider dependant object (TG_User or similar) :groups: a set of group IDs :permissions: a set of permission IDs |
---|
Constructs Identity object for user that has no associated visit_key.
Parameters: | user – The user structure the identity is constructed from |
---|---|
Returns: | an object with the following properties: :user_name: original user name :user: a provider dependant object (TG_User or similar) :groups: a set of group IDs :permissions: a set of permission IDs |
Create the database tables if they don’t already exist.
Lookup the principal represented by visit_key.
Parameters: | visit_key – The session key for whom we’re looking up an identity. |
---|---|
Returns: | an object with the following properties: :user_name: original user name :user: a provider dependant object (TG_User or similar) :groups: a set of group IDs :permissions: a set of permission IDs |
Look up the identity represented by user_name and determine whether the password is correct.
Must return either None if the credentials weren’t valid or an object with the following properties:
user_name: original user name user: a provider dependant object (TG_User or similar) groups: a set of group IDs permissions: a set of permission IDs
Parameters: |
|
---|
Check the supplied user_name and password against existing credentials. Note: user_name is not used here, but is required by external password validation schemes that might override this method. If you use SqlAlchemyIdentityProvider, but want to check the passwords against an external source (i.e. PAM, LDAP, Windows domain, etc), subclass SqlAlchemyIdentityProvider, and override this method.
Parameters: |
|
---|---|
Returns: | True if the password matches the username. Otherwise False. Can return False for problems within the Account System as well. |
This plugin provides integration with the Fedora Account System using JSON calls to the account system server.
Module author: Toshio Kuratomi <tkuratom@redhat.com>
This proxies visit requests to the Account System Server running remotely.
Create the Visit table if it doesn’t already exist.
Not needed as the visit tables reside remotely in the FAS2 database.
Return a new Visit object with the given key.
Update the visit information on the server
Return the visit for this key or None if the visit doesn’t exist or has expired.
These methods are deprecated because they do not provide the CSRF protection of TurboGears Identity Provider 2. Please use that identity provider instead.
Deprecated Use jsonfasprovider2 instead a it provides CSRF protection.
This plugin provides integration with the Fedora Account System using JSON calls.
Module author: Toshio Kuratomi <tkuratom@redhat.com>
Module author: Ricky Zhou <ricky@fedoraproject.org>
Associate an identity with a person in the auth system.
Return True if there’s no user logged in.
Return the user’s display name.
Return the groups that a user is a member of.
Remove the link between this identity and the visit.
Make an HTTP Request to a server method.
We need to override the send_request provided by BaseClient to keep the visit_key in sync.
Retrieve information about the user from cache or network.
Return the username for the user.
IdentityProvider that authenticates users against the fedora account system
Must return an object with the following properties:
User_name : | original user name |
---|---|
User : | a provider dependant object (TG_User or similar) |
Groups : | a set of group IDs |
Permissions : | a set of permission IDs |
Constructs Identity object for user that has no associated visit_key.
Create the database tables if they don’t already exist.
Lookup the principal represented by visit_key.
Parameters: | visit_key – The session key for whom we’re looking up an identity. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns: | an object with the following properties:
|
Look up the identity represented by user_name and determine whether the password is correct.
Must return either None if the credentials weren’t valid or an object with the following properties:
user_name: original user name user: a provider dependant object (TG_User or similar) groups: a set of group IDs permissions: a set of permission IDs
Check the supplied user_name and password against existing credentials. Note: user_name is not used here, but is required by external password validation schemes that might override this method. If you use SqlAlchemyIdentityProvider, but want to check the passwords against an external source (i.e. PAM, LDAP, Windows domain, etc), subclass SqlAlchemyIdentityProvider, and override this method.
Parameters: |
|
---|---|
Returns: | True if the password matches the username. Otherwise False. Can return False for problems within the Account System as well. |
This plugin provides integration with the Fedora Account System using JSON calls to the account system server.
Module author: Toshio Kuratomi <tkuratom@redhat.com>
This proxies visit requests to the Account System Server running remotely.
Create the Visit table if it doesn’t already exist.
Not needed as the visit tables reside remotely in the FAS2 database.
Return a new Visit object with the given key.
Update the visit information on the server
Return the visit for this key or None if the visit doesn’t exist or has expired.