This module hosts available auth types for encoding and matching user keys. For adding a new auth type, simply write a class that satisfies the following conditions:
Note that, since some of the encodings will be hashes, swauth supports the notion of salts. Thus, self.salt will be set to either a user-specified salt value or to a default value.
Maximum length any valid token should ever be.
Bases: object
Provides a particular auth type for encoding format for encoding and matching user keys.
This class must be all lowercase except for the first character, which must be capitalized. encode and match methods must be provided and are the only ones that will be used by swauth.
Encodes a user key into a particular format. The result of this method will be used by swauth for storing user credentials.
Parameters: | key – User’s secret key |
---|---|
Returns: | A string representing user credentials |
Checks whether the user-provided key matches the user’s credentials
Parameters: |
|
---|---|
Returns: | True if the supplied key is valid, False otherwise |
Bases: object
Provides a particular auth type for encoding format for encoding and matching user keys.
This class must be all lowercase except for the first character, which must be capitalized. encode and match methods must be provided and are the only ones that will be used by swauth.
Encodes a user key into a particular format. The result of this method will be used by swauth for storing user credentials.
Parameters: | key – User’s secret key |
---|---|
Returns: | A string representing user credentials |
Checks whether the user-provided key matches the user’s credentials
Parameters: |
|
---|---|
Returns: | True if the supplied key is valid, False otherwise |