Skip to content

Instantly share code, notes, and snippets.

@jeffdeville
Created March 18, 2015 14:51
Show Gist options
  • Save jeffdeville/cdaca7cde17437fb0dc8 to your computer and use it in GitHub Desktop.
Save jeffdeville/cdaca7cde17437fb0dc8 to your computer and use it in GitHub Desktop.
@dependency.requires('assignment_api', 'identity_api')
class InferredDomain(Domain):
def _authenticate(self, remote_user, context):
# OIDC sets the remote user as:
# remote_user = [email protected]@sso.sungardas.lab/service
# so if we use the email's domain as the remote_domain, it'd be as simple as this:
context['environment']['REMOTE_DOMAIN'] = remote_user.split("@")[1]
return super(InferredDomain, self)._authenticate(remote_user, context)
{"token": {"methods": ["oidc"], "expires_at": "2015-03-18T15:49:38.604631Z", "extras": {}, "user": {"domain": {"id": "2b5d69791f304f0e9d56219852528bcf", "name": "sungardas.com"}, "id": "3d0a1984dc5c4391b6f4cfdfbf714770", "name": "[email protected]@sso.sungardas.lab/service"}, "audit_ids": ["3bbus0UzTrqr-L7mQSojcA"], "issued_at": "2015-03-18T14:49:38.604661Z"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment