Пример #1
0
Файл: oidc.py Проект: zhill/quay
    def _get_endpoint(self, endpoint_key, **kwargs):
        """ Returns the OIDC endpoint with the given key found in the OIDC discovery
        document, with the given kwargs added as query parameters. Additionally,
        any defined parameters found in the OIDC configuration block are also
        added.
    """
        endpoint = self._oidc_config().get(endpoint_key, "")
        if not endpoint:
            return None

        (scheme, netloc, path, query, fragment) = urlparse.urlsplit(endpoint)

        # Add the query parameters from the kwargs and the config.
        custom_parameters = self.config.get("OIDC_ENDPOINT_CUSTOM_PARAMS",
                                            {}).get(endpoint_key, {})

        query_params = urlparse.parse_qs(query, keep_blank_values=True)
        query_params.update(kwargs)
        query_params.update(custom_parameters)
        return OAuthEndpoint(
            urlparse.urlunsplit((scheme, netloc, path, {}, fragment)),
            query_params)
Пример #2
0
 def token_endpoint(self):
   return OAuthEndpoint(slash_join(self._endpoint(), '/oauth/token'))
Пример #3
0
 def authorize_endpoint(self):
   return OAuthEndpoint(slash_join(self._endpoint(), '/oauth/authorize'))
Пример #4
0
 def user_endpoint(self):
     return OAuthEndpoint(slash_join(self._api_endpoint(), 'user'))
Пример #5
0
 def token_endpoint(self):
     return OAuthEndpoint(
         slash_join(self._endpoint(), '/login/oauth/access_token'))
Пример #6
0
 def user_endpoint(self):
     return OAuthEndpoint("https://www.googleapis.com/oauth2/v1/userinfo")
Пример #7
0
 def token_endpoint(self):
     return OAuthEndpoint("https://accounts.google.com/o/oauth2/token")
Пример #8
0
 def authorize_endpoint(self):
     return OAuthEndpoint("https://accounts.google.com/o/oauth2/auth",
                          params=dict(response_type="code"))
Пример #9
0
 def authorize_endpoint(self):
     return OAuthEndpoint(
         slash_join(self._endpoint(), "/login/oauth/authorize"))