Defernia provides various (currently two) ways to sign in: Login with Facebook, Login with Twitter, and other services could be added in the future.
Credential abstracts each detail of various login services.
In order to define a new credential service, subclass Credential and then define typeid class attribute:
class WindowsLive(Credential):
'''The Microsoft's legendary SSO (single sign on) service,
was Passport before.
'''
typeid = 'live.com'
Note that typeid should be the service’s canonical domain name such as 'live.com'. This attribute will be internally used for service identifier.
Bases: sqlalchemy.ext.declarative.api.Base
Defernia user credentials.
The class attribute to be defined for concrete subclasses. It is a default type of the class. It should be the service’s canonical domain name such as 'facebook.com'.
The owner.
The credential type e.g. 'facebook.com', 'twitter.com'. It should be the service’s canonical domain name.
The user identifier used in the service.
The extra data for the credential.
A class method that finds the subtype of the given typeid.
Parameters: | typeid (basestring) – internally used typeid string e.g. 'facebook.com' |
---|---|
Returns: | a subtype of Credential |
Return type: | type |
Rairses : | LookupError when cannot found the class |
Lists all credential types.
Parameters: | mixin (type) – an optional mixin class filter. if it is present, lists only subclass of given mixin |
---|---|
Returns: | a dictionary of credential types (keys are typeid strings) |
Return type: | dict |
Makes a descriptor that deals with data dictionary’s specific key.
class HongMinheeWebsite(Credential):
typeid = 'dahlia.kr'
gender = data_property('gender', "The ``'male'`` or ``'female'``.")
birthday = data_property('birthday')
Parameters: |
|
---|---|
Returns: | a descriptor for key |
Return type: | property |
Bases: defernia.creds.Credential
The credential mixin class for getting profile pictures.
The profile picture URL. To be overrided in the subclass. None if there’s no picture.
Bases: defernia.creds.PictureMixin
Login with Facebook.
Bases: defernia.creds.PictureMixin
Login with Twitter.
The Twitter screen name.