flask-multipass icon indicating copy to clipboard operation
flask-multipass copied to clipboard

Add pretty identifier

Open OmeGak opened this issue 11 years ago • 0 comments

Identity.identifier, while being the uid in the identity provider it is also quite meaningless when displayed to users (i.e. For Github, it is a numeric id instead of the username). We should have a way to specify which data field of the identity from a provider is the one relevant to the user. Something along this line would be a first approach to tackle it.

@property
def pretty_identifier(self):
    return self.data[provider_settings['pretty_identifier']] if provider_settings['pretty_identifier'] else self.identifier
IdentityProviders = {
    'github': {
        'type': 'oauth',
        'title': 'GitHub',
        'oauth': _github_oauth_config,
        'identifier_field': 'id',
        'pretty_identifier': 'username',
    },

OmeGak avatar Apr 23 '15 13:04 OmeGak