Example #1
0
 def validate_redirect_uri(self, client_id, redirect_uri, request, *args,
                           **kwargs):
     # Is the client allowed to use the supplied redirect_uri? i.e. has
     # the client previously registered this EXACT redirect uri.
     client = Client.objects(client_id=client_id).first()
     base_uri = get_auth_base_uri()
     if client:
         for uri in client.redirect_uris:
             if redirect_uri == base_uri + uri:
                 return True
     return False
Example #2
0
 def validate_redirect_uri(self, client_id, redirect_uri, request,
                           *args, **kwargs):
     # Is the client allowed to use the supplied redirect_uri? i.e. has
     # the client previously registered this EXACT redirect uri.
     client = Client.objects(client_id=client_id).first()
     base_uri = get_auth_base_uri()
     if client:
         for uri in client.redirect_uris:
             if redirect_uri == base_uri + uri:
                 return True
     return False
Example #3
0
 def get_default_redirect_uri(self, client_id, request, *args, **kwargs):
     # The redirect used if none has been supplied.
     # Prefer your clients to pre register a redirect uri rather than
     # supplying one on each authorization request.
     client = Client.objects(client_id=client_id).first()
     return get_auth_base_uri() + client.default_redirect_uri
Example #4
0
 def confirm_redirect_uri(self, client_id, code, redirect_uri, client,
                          *args, **kwargs):
     # You did save the redirect uri with the authorization code right?
     c = Code.objects(code=code, client=client).first()
     uri = get_auth_base_uri() + redirect_uri
     return c.redirect_uri == redirect_uri or uri == c.redirect_uri
Example #5
0
 def get_default_redirect_uri(self, client_id, request, *args, **kwargs):
     # The redirect used if none has been supplied.
     # Prefer your clients to pre register a redirect uri rather than
     # supplying one on each authorization request.
     client = Client.objects(client_id=client_id).first()
     return get_auth_base_uri() + client.default_redirect_uri
Example #6
0
 def confirm_redirect_uri(self, client_id, code, redirect_uri, client,
                          *args, **kwargs):
     # You did save the redirect uri with the authorization code right?
     c = Code.objects(code=code, client=client).first()
     uri = get_auth_base_uri() + redirect_uri
     return c.redirect_uri == redirect_uri or uri == c.redirect_uri