Changeset 8030


Ignore:
Timestamp:
29/02/12 13:13:19 (7 years ago)
Author:
rwilkinson
Message:

Reorganised into ndg.oauth.client and ndg.oauth.server package
structures. Removed development test application and references to
Pylons and other unused packages.

Location:
trunk/ndg_oauth
Files:
18 added
23 deleted
25 edited
2 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/ndg_oauth/ndg_oauth_client/get_url_app_proxy.ini

    r8026 r8030  
    4141 
    4242[filter:OAuth2Client] 
    43 paste.filter_app_factory = ndgoauthclient.wsgi.oauth2_client:Oauth2ClientMiddleware.filter_app_factory 
     43paste.filter_app_factory = ndg.oauth.client.wsgi.oauth2_client:Oauth2ClientMiddleware.filter_app_factory 
    4444oauth2.session_key = %(beakerSessionKeyName)s 
    4545# Default: 
     
    5252oauth2.client_id=22 
    5353# OAuth authorization server URLs 
    54 oauth2.authorization_endpoint=https://ice.badc.rl.ac.uk:443/oas/oauth/authorize 
    55 oauth2.access_token_endpoint=https://ice.badc.rl.ac.uk:443/oas/oauth/access_token 
    56 #oauth2.authorization_endpoint=https://ice.badc.rl.ac.uk:5000/oauth/authorize 
    57 #oauth2.access_token_endpoint=https://ice.badc.rl.ac.uk:5000/oauth/access_token 
    58 # 
     54oauth2.authorization_endpoint=https://localhost:443/oas/oauth/authorize 
     55oauth2.access_token_endpoint=https://localhost:443/oas/oauth/access_token 
     56# Relative base path included in OAuth client URLs 
    5957oauth2.base_url_path=/oauth2 
    6058 
     
    7371 
    7472[app:App] 
    75 paste.app_factory = ndgoauthclient.wsgi.get_url_app:GetUrlApp.app_factory 
    76 url = http://ice.badc.rl.ac.uk:8080/thredds/dodsC/test/testData.nc.ascii 
     73paste.app_factory = ndg.oauth.client.wsgi.get_url_app:GetUrlApp.app_factory 
     74url = http://localhost:8080/thredds/dodsC/test/testData.nc.ascii 
    7775 
    7876# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 
     
    110108level = DEBUG 
    111109handlers = 
    112 qualname = ndgoauthclient 
     110qualname = ndg.oauth.client 
    113111 
    114112[handler_console] 
  • trunk/ndg_oauth/ndg_oauth_client/ndg/oauth/client/lib/oauth2_myproxy_client.py

    r7950 r8030  
    1010import base64 
    1111 
    12 from ndgoauthclient.lib.oauth2client import Oauth2Client 
    13 import ndgoauthclient.lib.openssl_cert as openssl_cert 
     12from ndg.oauth.client.lib.oauth2client import Oauth2Client 
     13import ndg.oauth.client.lib.openssl_cert as openssl_cert 
    1414 
    1515class Oauth2MyProxyClient(Oauth2Client): 
  • trunk/ndg_oauth/ndg_oauth_client/ndg/oauth/client/lib/oauth2client.py

    r8026 r8030  
    1313import uuid 
    1414 
    15 import ndgoauthclient.lib.urlfetcher as urlfetcher 
     15import ndg.oauth.client.lib.urlfetcher as urlfetcher 
    1616 
    1717log = logging.getLogger(__name__) 
  • trunk/ndg_oauth/ndg_oauth_client/ndg/oauth/client/wsgi/oauth2_client.py

    r8026 r8030  
    1313from webob import Request 
    1414 
    15 from ndgoauthclient.lib.oauth2client import Oauth2ClientConfig 
    16 from ndgoauthclient.lib.oauth2_myproxy_client import Oauth2MyProxyClient 
     15from ndg.oauth.client.lib.oauth2client import Oauth2ClientConfig 
     16from ndg.oauth.client.lib.oauth2_myproxy_client import Oauth2MyProxyClient 
    1717from ndg.httpsclient.ssl_context_util import SSlContextConfig 
    1818 
  • trunk/ndg_oauth/ndg_oauth_client/serve.py

    r7950 r8030  
    11from paste.script.serve import ServeCommand 
    22 
    3 ServeCommand("serve").run(["test_app.ini"]) 
     3ServeCommand("serve").run(["get_url_app_proxy.ini"]) 
     4#ServeCommand("serve").run(["test_app.ini"]) 
    45#ServeCommand("serve").run(["development.ini"]) 
  • trunk/ndg_oauth/ndg_oauth_client/setup.cfg

    r8004 r8030  
    11[egg_info] 
    22tag_svn_revision = true 
    3  
    4 [easy_install] 
    5 find_links = http://www.pylonshq.com/download/ 
    6  
    7 [nosetests] 
    8 with-pylons = test.ini 
    9  
    10 # Babel configuration 
    11 [compile_catalog] 
    12 domain = ndgoauthclient 
    13 directory = ndgoauthclient/i18n 
    14 statistics = true 
    15  
    16 [extract_messages] 
    17 add_comments = TRANSLATORS: 
    18 output_file = ndgoauthclient/i18n/ndgoauthclient.pot 
    19 width = 80 
    20  
    21 [init_catalog] 
    22 domain = ndgoauthclient 
    23 input_file = ndgoauthclient/i18n/ndgoauthclient.pot 
    24 output_dir = ndgoauthclient/i18n 
    25  
    26 [update_catalog] 
    27 domain = ndgoauthclient 
    28 input_file = ndgoauthclient/i18n/ndgoauthclient.pot 
    29 output_dir = ndgoauthclient/i18n 
    30 previous = true 
  • trunk/ndg_oauth/ndg_oauth_client/setup.py

    r8026 r8030  
     1__author__ = "R B Wilkinson" 
     2__date__ = "29/02/12" 
     3__copyright__ = "(C) 2012 Science and Technology Facilities Council" 
     4__license__ = "BSD - see LICENSE file in top-level directory" 
     5__contact__ = "Philip.Kershaw@stfc.ac.uk" 
     6__revision__ = "$Id$" 
     7 
    18try: 
    29    from setuptools import setup, find_packages 
     
    613    from setuptools import setup, find_packages 
    714 
     15_long_description = """\ 
     16This is an OAuth 2.0 client library and WSGI middleware filter. 
     17 
     18Its intended use is to make requests to the NDG OAuth server, which returns as 
     19access tokens certificates obtained from a MyProxy server. 
     20 
     21ndg.oauth.client.lib.oauth2client:Oauth2Client is a client that calls a 
     22specified callable with an access token obtained from a configured OAuth server. 
     23ndg.oauth.client.lib.oauth2_myproxy_client:Oauth2MyProxyClient extends this to 
     24handle key creation for obtaining MyProxy certificates. 
     25 
     26The filter ndg.oauth.client.wsgi.oauth2_client:Oauth2ClientMiddleware uses 
     27Oauth2MyProxyClient and sets the obtained access token in the WSGI environ. The 
     28token contains the key/certificate pair so that it can be used by other WSGI 
     29applications or middleware to authenticate. 
     30 
     31Prerequisites 
     32============= 
     33This has been developed and tested for Python 2.6. 
     34 
     35Installation 
     36============ 
     37Installation can be performed using easy_install or pip.   
     38 
     39Configuration 
     40============= 
     41Examples of configuration files for WSGI stacks are: 
     42test_app.ini: 
     43  This configures a simple test application that simply displays the key and 
     44  certificate. 
     45get_url_app_proxy.ini: 
     46  This is a more complex example that uses the NDG Security proxy. The 
     47  application makes a request to a configured URL using the security proxy. The 
     48  proxy uses a key/certificate pair obtained using NDG OAuth to authenticate the 
     49  request. 
     50""" 
     51 
    852setup( 
    9     name='ndgoauthclient', 
    10     version='0.1.1', 
    11     description='OAuth 2.0 client', 
    12     author='R. B. Wilkinson', 
    13     #author_email='', 
    14     #url='', 
    15     install_requires=[ 
    16         "Pylons>=1.0", 
    17         "Genshi>=0.4", 
     53    name =                      'ndg_oauth_client', 
     54    version =                   '0.2.0', 
     55    description =               'OAuth 2.0 client', 
     56    author =                    'R. B. Wilkinson', 
     57    maintainer =                'Philip Kershaw', 
     58    maintainer_email =          'Philip.Kershaw@stfc.ac.uk', 
     59    #url ='', 
     60    license =                   'BSD - See LICENCE file for details', 
     61    install_requires =[ 
     62        "PasteScript", 
     63        "Beaker", 
     64        "WebOb", 
     65        "pyOpenSSL", 
     66        "ndg_httpsclient", 
     67        "pyasn1", 
    1868    ], 
    19     setup_requires=["PasteScript>=1.6.3"], 
    20     packages=find_packages(exclude=['ez_setup']), 
    21     include_package_data=True, 
    22     test_suite='nose.collector', 
    23     package_data={'ndgoauthclient': ['i18n/*/LC_MESSAGES/*.mo']}, 
    24     #message_extractors={'ndgoauthclient': [ 
    25     #        ('**.py', 'python', None), 
    26     #        ('public/**', 'ignore', None)]}, 
    27     zip_safe=False, 
    28     paster_plugins=['PasteScript', 'Pylons'], 
    29     entry_points=""" 
    30     [paste.app_factory] 
    31     main = ndgoauthclient.config.middleware:make_app 
    32  
    33     [paste.app_install] 
    34     main = pylons.util:PylonsInstaller 
    35     """, 
     69    packages =find_packages(), 
     70    zip_safe =False, 
    3671) 
  • trunk/ndg_oauth/ndg_oauth_client/test_app.ini

    r7950 r8030  
    3939 
    4040[filter:OAuth2Client] 
    41 paste.filter_app_factory = ndgoauthclient.wsgi.oauth2_client:Oauth2ClientMiddleware.filter_app_factory 
     41paste.filter_app_factory = ndg.oauth.client.wsgi.oauth2_client:Oauth2ClientMiddleware.filter_app_factory 
    4242oauth2.session_key = %(beakerSessionKeyName)s 
     43# Default: 
     44#oauth2.oauth2_token_key = oauth2client.token 
    4345# OAuth client configuration 
    44 oauth2.client_cert = /home/rwilkinson_local/dev/oauthclient/certificate/usercert.pem 
    45 oauth2.client_key = /home/rwilkinson_local/dev/oauthclient/certificate/userkey.pem 
    46 oauth2.ca_dir = /home/rwilkinson_local/dev/oauthclient/ca 
     46oauth2.client_cert = /home/rwilkinson_local/dev/ndg_oauth/certificate/usercert.pem 
     47oauth2.client_key = /home/rwilkinson_local/dev/ndg_oauth/certificate/userkey.pem 
     48oauth2.ca_dir = /home/rwilkinson_local/dev/ndg_oauth/ca 
    4749# ca_cert_file = /home/rwilkinson_local/dev/oauthclient/ca.pem 
    4850oauth2.client_id=22 
    4951# OAuth authorization server URLs 
    50 #oauth2.authorization_endpoint=https://ice.badc.rl.ac.uk:443/oauth/authorize 
    51 #oauth2.access_token_endpoint=https://ice.badc.rl.ac.uk:443/oauth/access_token 
    52 oauth2.authorization_endpoint=https://ice.badc.rl.ac.uk:5000/oauth/authorize 
    53 oauth2.access_token_endpoint=https://ice.badc.rl.ac.uk:5000/oauth/access_token 
    54 # 
     52oauth2.authorization_endpoint=https://localhost:443/oas/oauth/authorize 
     53oauth2.access_token_endpoint=https://localhost:443/oas/oauth/access_token 
     54# Relative base path included in OAuth client URLs 
    5555oauth2.base_url_path=/oauth2 
    5656 
    5757[app:App] 
    58 paste.app_factory = ndgoauthclient.wsgi.wsgi_test_app:WsgiTestApp.app_factory 
     58paste.app_factory = ndg.oauth.client.wsgi.wsgi_test_app:WsgiTestApp.app_factory 
    5959 
    6060# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 
     
    9292level = DEBUG 
    9393handlers = 
    94 qualname = ndgoauthclient 
     94qualname = ndg.oauth.client 
    9595 
    9696[handler_console] 
  • trunk/ndg_oauth/ndg_oauth_server/client_register.ini

    r7950 r8030  
    1010#id=477bfc8c-a739-45b3-a63b-5b1662cc12d7 
    1111type=confidential 
    12 redirect_uris=http://ice.badc.rl.ac.uk:5001/client/redirect_target 
    13 authentication_data=/O=STFC/OU=BADC/OU=simpleCA-ice.badc.rl.ac.uk/OU=badc.rl.ac.uk/CN=test1.client 
     12redirect_uris=http://localhost:5001/client/redirect_target 
     13authentication_data=/O=STFC/OU=BADC/OU=simpleCA-localhost/OU=badc.rl.ac.uk/CN=test1.client 
    1414 
    1515[client:test2] 
     
    1818#id=691ad8cc-293c-4fbe-b8eb-980fcd621157 
    1919type=confidential 
    20 redirect_uris=http://ice.badc.rl.ac.uk:5002/oauth2/oauth_redirect 
    21 authentication_data=/O=STFC/OU=BADC/OU=simpleCA-ice.badc.rl.ac.uk/OU=badc.rl.ac.uk/CN=test.client 
     20redirect_uris=http://localhost:5002/oauth2/oauth_redirect 
     21authentication_data=/O=STFC/OU=BADC/OU=simpleCA-localhost/OU=badc.rl.ac.uk/CN=test.client 
  • trunk/ndg_oauth/ndg_oauth_server/development.ini

    r8004 r8030  
    11# 
    2 # ndgoauthserver - Pylons development environment configuration 
     2# NDG OAuth Server - Pylons development environment configuration 
    33# 
    44# The %(here)s variable will be replaced with the parent directory of this file 
     
    5151# fully qualified domain name or else set the MYPROXY_SERVER environment 
    5252# variable.  See the documentation for the MyProxyClient egg for details 
    53 myproxy.client.hostname = ice.badc.rl.ac.uk 
     53myproxy.client.hostname = localhost 
    5454#myproxy.client.port = 7512 
    5555 
     
    6262[filter:OAuth2Authz] 
    6363# Authorization filter configuration options - defaults are commented out. 
    64 paste.filter_app_factory = ndgoauthserver.wsgi.authorization_filter:Oauth2AuthorizationMiddleware.filter_app_factory 
     64paste.filter_app_factory = ndg.oauth.server.wsgi.authorization_filter:Oauth2AuthorizationMiddleware.filter_app_factory 
    6565oauth2authorization.base_url_path=/client_authorization 
    66 oauth2authorization.client_authorization_form=%(here)s/ndgoauthserver/templates/auth_client_form.html 
     66oauth2authorization.client_authorization_form=%(here)s/ndg/oauth/server/templates/auth_client_form.html 
    6767#oauth2authorization.client_authorizations_key=client_authorizations 
    6868oauth2authorization.client_register=%(here)s/client_register.ini 
     
    7171 
    7272[app:OAuth2Server] 
    73 paste.app_factory = ndgoauthserver.wsgi.oauth2_server:Oauth2ServerMiddleware.app_factory 
     73paste.app_factory = ndg.oauth.server.wsgi.oauth2_server:Oauth2ServerMiddleware.app_factory 
    7474 
    7575# OAuth2 server configuration options - defaults are commented out. 
     
    133133level = DEBUG 
    134134handlers = 
    135 qualname = ndgoauthserver 
     135qualname = ndg.oauth.server 
    136136 
    137137[handler_console] 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/access_token/bearer_token_generator.py

    r7952 r8030  
    1010import uuid 
    1111 
    12 from ndgoauthserver.lib.access_token.access_token_interface import AccessTokenInterface 
    13 from ndgoauthserver.lib.register.access_token import AccessToken 
     12from ndg.oauth.server.lib.access_token.access_token_interface import AccessTokenInterface 
     13from ndg.oauth.server.lib.register.access_token import AccessToken 
    1414 
    1515class BearerTokenGenerator(AccessTokenInterface): 
     
    3232        Gets an access token with an ID that is a random UUID used as a bearer 
    3333        token. 
    34         @type token_request: ndgoauthserver.lib.access_token.AccessTokenRequest 
     34        @type token_request: ndg.oauth.server.lib.access_token.AccessTokenRequest 
    3535        @param token_request: access token request 
    3636 
    37         @type grant: ndgoauthserver.lib.register.authorization_grant.AuthorizationGrant 
     37        @type grant: ndg.oauth.server.lib.register.authorization_grant.AuthorizationGrant 
    3838        @param grant: authorization grant 
    3939 
     
    4141        @param request: HTTP request object 
    4242 
    43         @rtype: ndgoauthserver.lib.register.access_token.AccessToken 
     43        @rtype: ndg.oauth.server.lib.register.access_token.AccessToken 
    4444        @return: access token or None if an error occurs 
    4545        """ 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/access_token/make_access_token.py

    r7952 r8030  
    1010from datetime import datetime 
    1111 
    12 from ndgoauthserver.lib.oauth.oauth_exception import OauthException 
    13 from ndgoauthserver.lib.oauth.access_token import AccessTokenResponse 
     12from ndg.oauth.server.lib.oauth.oauth_exception import OauthException 
     13from ndg.oauth.server.lib.oauth.access_token import AccessTokenResponse 
    1414 
    1515AUTHORIZATION_CODE_GRANT_TYPE = 'authorization_code' 
     
    4949    # This requires that the client has authenticated itself so that the 
    5050    # client identity is known. 
    51     # TODO client_id is None if client authentication is not configured. Is there 
    52     # a better way to signal that authentication is disabled for testing? 
     51    # client_id is None if client authentication is not configured - this 
     52    # signals that authentication is disabled for testing. 
    5353    if client_id and (grant.client_id != client_id): 
    5454        raise OauthException('invalid_grant', 'Token granted for different client') 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/access_token/myproxy_cert_token_generator.py

    r7952 r8030  
    1111import logging 
    1212 
    13 from ndgoauthserver.lib.access_token.access_token_interface import AccessTokenInterface 
    14 from ndgoauthserver.lib.register.access_token import AccessToken 
     13from ndg.oauth.server.lib.access_token.access_token_interface import AccessTokenInterface 
     14from ndg.oauth.server.lib.register.access_token import AccessToken 
    1515 
    1616log = logging.getLogger(__name__) 
     
    4141        """ 
    4242        Gets an access token using MyProxyClient. 
    43         @type token_request: ndgoauthserver.lib.access_token.AccessTokenRequest 
     43        @type token_request: ndg.oauth.server.lib.access_token.AccessTokenRequest 
    4444        @param token_request: access token request 
    4545 
    46         @type grant: ndgoauthserver.lib.register.authorization_grant.AuthorizationGrant 
     46        @type grant: ndg.oauth.server.lib.register.authorization_grant.AuthorizationGrant 
    4747        @param grant: authorization grant 
    4848 
     
    5050        @param request: HTTP request object 
    5151 
    52         @rtype: ndgoauthserver.lib.register.access_token.AccessToken 
     52        @rtype: ndg.oauth.server.lib.register.access_token.AccessToken 
    5353        @return: access token or None if an error occurs 
    5454        """ 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/authenticate/certificate_client_authenticator.py

    r7952 r8030  
    88__revision__ = "$Id$" 
    99 
    10 from ndgoauthserver.lib.authenticate.client_authenticator_interface import ClientAuthenticatorInterface 
    11 from ndgoauthserver.lib.oauth.oauth_exception import OauthException 
    12 from ndgoauthserver.lib.register.client import ClientRegister 
     10from ndg.oauth.server.lib.authenticate.client_authenticator_interface import ClientAuthenticatorInterface 
     11from ndg.oauth.server.lib.oauth.oauth_exception import OauthException 
     12from ndg.oauth.server.lib.register.client import ClientRegister 
    1313 
    1414class CertificateClientAuthenticator(ClientAuthenticatorInterface): 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/authenticate/noop_client_authenticator.py

    r7952 r8030  
    88__revision__ = "$Id$" 
    99 
    10 from ndgoauthserver.lib.authenticate.client_authenticator_interface import ClientAuthenticatorInterface 
     10from ndg.oauth.server.lib.authenticate.client_authenticator_interface import ClientAuthenticatorInterface 
    1111 
    1212class NoopClientAuthenticator(ClientAuthenticatorInterface): 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/authenticate/test_authenticator.py

    r7952 r8030  
    88__revision__ = "$Id$" 
    99 
    10 from ndgoauthserver.lib.authenticate.authenticator_interface import AuthenticatorInterface 
     10from ndg.oauth.server.lib.authenticate.authenticator_interface import AuthenticatorInterface 
    1111 
    1212class TestAuthenticator(AuthenticatorInterface): 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/authorization_server.py

    r7952 r8030  
    1313import urllib 
    1414 
    15 from ndgoauthserver.lib.access_token.make_access_token import make_access_token 
    16 from ndgoauthserver.lib.oauth.access_token import AccessTokenRequest 
    17 from ndgoauthserver.lib.oauth.authorize import AuthorizeRequest, AuthorizeResponse 
    18 from ndgoauthserver.lib.oauth.oauth_exception import OauthException 
    19 from ndgoauthserver.lib.register.access_token import AccessTokenRegister 
    20 from ndgoauthserver.lib.register.client import ClientRegister 
    21 from ndgoauthserver.lib.register.authorization_grant import AuthorizationGrantRegister 
     15from ndg.oauth.server.lib.access_token.make_access_token import make_access_token 
     16from ndg.oauth.server.lib.oauth.access_token import AccessTokenRequest 
     17from ndg.oauth.server.lib.oauth.authorize import AuthorizeRequest, AuthorizeResponse 
     18from ndg.oauth.server.lib.oauth.oauth_exception import OauthException 
     19from ndg.oauth.server.lib.register.access_token import AccessTokenRegister 
     20from ndg.oauth.server.lib.register.client import ClientRegister 
     21from ndg.oauth.server.lib.register.authorization_grant import AuthorizationGrantRegister 
    2222 
    2323log = logging.getLogger(__name__) 
     
    3333        self.client_authenticator = client_authenticator 
    3434        self.access_token_generator = access_token_generator 
    35         # TODO Need configuration 
    3635        self.access_token_register = AccessTokenRegister(config) 
    3736        self.authorization_grant_register = AuthorizationGrantRegister(config) 
     
    3938    def authorize(self, request, client_authorized): 
    4039        """Handle an authorization request. 
     40 
     41        It is assumed that the caller has checked whether the user is 
     42        authenticated and that the user has authorised the client and scope. 
    4143 
    4244        Request query parameters (from http://tools.ietf.org/html/draft-ietf-oauth-v2-22): 
     
    128130                return (None, httplib.BAD_REQUEST, 'An authorization request has been made without a return URI.') 
    129131 
    130  
    131             # TODO Check this: 
    132             # Assume other preconditions enforced elsewhere: 
    133             # o User authenticated. 
    134             # o User authorises the client and scope. 
     132            # Preconditions satisfied - generate grant. 
    135133            (grant, code) = self.authorizer.generate_authorization_grant(auth_request, request) 
    136134            auth_response = AuthorizeResponse(code, auth_request.state) 
     
    150148        completed. 
    151149 
    152         @type resp: ndgoauthserver.lib.oauth.authorize.AuthorizeRequest 
     150        @type resp: ndg.oauth.server.lib.oauth.authorize.AuthorizeRequest 
    153151        @param resp: OAuth authorize request 
    154152         
    155         @type resp: ndgoauthserver.lib.oauth.authorize.AuthorizeResponse 
     153        @type resp: ndg.oauth.server.lib.oauth.authorize.AuthorizeResponse 
    156154        @param resp: OAuth authorize response 
    157155 
     
    299297    def _access_token_response(self, resp): 
    300298        """Constructs the JSON response to an access token request. 
    301         @type resp: ndgoauthserver.lib.oauth.access_token.AccessTokenResponse 
     299        @type resp: ndg.oauth.server.lib.oauth.access_token.AccessTokenResponse 
    302300        @param resp: OAuth access token response 
    303301 
     
    334332        o Optionally, must use the POST method. 
    335333        o Parameters must not be repeated. 
    336         If the request is directly from the client: 
    337         o TODO Must be authenticated. 
     334        If the request is directly from the client, the user must be 
     335        authenticated - it is assumed that the caller has checked this. 
    338336 
    339337        Raises OauthException if any check fails. 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/authorize/authorizer.py

    r7952 r8030  
    1111import uuid 
    1212 
    13 from ndgoauthserver.lib.authorize.authorizer_interface import AuthorizerInterface 
    14 from ndgoauthserver.lib.register.authorization_grant import AuthorizationGrant 
     13from ndg.oauth.server.lib.authorize.authorizer_interface import AuthorizerInterface 
     14from ndg.oauth.server.lib.register.authorization_grant import AuthorizationGrant 
    1515 
    1616log = logging.getLogger(__name__) 
     
    2626    def generate_authorization_grant(self, auth_request, request): 
    2727        """Generates an authorization grant. 
    28         @type auth_request: ndgoauthserver.lib.oauth.authorize.AuthorizeRequest 
     28        @type auth_request: ndg.oauth.server.lib.oauth.authorize.AuthorizeRequest 
    2929        @param auth_request: authorization request 
    3030 
     
    3333 
    3434        @rtype: tuple ( 
    35             ndgoauthserver.lib.register.authorization_grant.AuthorizationGrant 
     35            ndg.oauth.server.lib.register.authorization_grant.AuthorizationGrant 
    3636            str 
    3737        ) 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/authorize/authorizer_storing_identifier.py

    r7952 r8030  
    1111import uuid 
    1212 
    13 from ndgoauthserver.lib.authorize.authorizer_interface import AuthorizerInterface 
    14 from ndgoauthserver.lib.oauth.oauth_exception import OauthException 
    15 from ndgoauthserver.lib.register.authorization_grant import AuthorizationGrant 
     13from ndg.oauth.server.lib.authorize.authorizer_interface import AuthorizerInterface 
     14from ndg.oauth.server.lib.oauth.oauth_exception import OauthException 
     15from ndg.oauth.server.lib.register.authorization_grant import AuthorizationGrant 
    1616 
    1717log = logging.getLogger(__name__) 
     
    3939    def generate_authorization_grant(self, auth_request, request): 
    4040        """Generates an authorization grant. 
    41         @type auth_request: ndgoauthserver.lib.oauth.authorize.AuthorizeRequest 
     41        @type auth_request: ndg.oauth.server.lib.oauth.authorize.AuthorizeRequest 
    4242        @param auth_request: authorization request 
    4343 
     
    4646 
    4747        @rtype: tuple ( 
    48             ndgoauthserver.lib.register.authorization_grant.AuthorizationGrant 
     48            ndg.oauth.server.lib.register.authorization_grant.AuthorizationGrant 
    4949            str 
    5050        ) 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/register/access_token.py

    r7952 r8030  
    1111import logging 
    1212 
    13 from ndgoauthserver.lib.register.register_base import RegisterBase 
     13from ndg.oauth.server.lib.register.register_base import RegisterBase 
    1414 
    1515log = logging.getLogger(__name__) 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/lib/register/authorization_grant.py

    r7952 r8030  
    1111import logging 
    1212 
    13 from ndgoauthserver.lib.register.register_base import RegisterBase 
     13from ndg.oauth.server.lib.register.register_base import RegisterBase 
    1414 
    1515log = logging.getLogger(__name__) 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/wsgi/authorization_filter.py

    r8004 r8030  
    1414from webob import Request 
    1515 
    16 from ndgoauthserver.lib.register.client import ClientRegister 
    17 from ndgoauthserver.lib.register.client_authorization import ClientAuthorization, ClientAuthorizationRegister 
     16from ndg.oauth.server.lib.register.client import ClientRegister 
     17from ndg.oauth.server.lib.register.client_authorization import ( 
     18                            ClientAuthorization, ClientAuthorizationRegister) 
     19from ndg.oauth.server.lib.render.factory import callModuleObject 
     20from ndg.oauth.server.lib.render.renderer_interface import RendererInterface 
    1821 
    1922log = logging.getLogger(__name__) 
     
    3437    CLIENT_AUTHORIZATIONS_KEY_OPTION = 'client_authorizations_key' 
    3538    CLIENT_REGISTER_OPTION = 'client_register' 
     39    RENDERER_CLASS_OPTION = 'renderer_class' 
    3640    SESSION_KEY_OPTION = 'session_key_name' 
    3741    USER_IDENTIFIER_KEY_OPTION = 'user_identifier_key' 
     
    4347    propertyDefaults = { 
    4448        BASE_URL_PATH_OPTION: 'client_authorization', 
     49        RENDERER_CLASS_OPTION: 'ndg.oauth.server.lib.render.genshi_renderer.GenshiRenderer', 
    4550        SESSION_KEY_OPTION: 'beaker.session.oauth2authorization', 
    4651        CLIENT_AUTHORIZATIONS_KEY_OPTION: 'client_authorizations', 
     
    7176        self._set_configuration(prefix, local_conf) 
    7277        self.client_register = ClientRegister(self.client_register_file) 
     78        self.renderer = callModuleObject(self.renderer_class, 
     79                                         objectName=None, moduleFilePath=None,  
     80                                         objectType=RendererInterface, 
     81                                         objectArgs=None, objectProperties=None) 
    7382 
    7483    def __call__(self, environ, start_response): 
     
    129138        if client_authorizations: 
    130139            log.debug("_set_client_authorizations_in_environ %s", client_authorizations.__repr__()) 
    131             # TODO Should this be a deep copy so that the session copy cannot 
    132             # be modified by other filters? 
    133140            environ[self.client_authorizations_env_key] = client_authorizations 
    134141        else: 
     
    198205        """ 
    199206        client = self.client_register.register.get(client_id) 
    200         tmpl_file = open(self.client_authorization_form) 
    201         tmpl = MarkupTemplate(tmpl_file) 
    202         tmpl_file.close() 
     207#        tmpl_file = open(self.client_authorization_form) 
     208#        tmpl = MarkupTemplate(tmpl_file) 
     209#        tmpl_file.close() 
    203210        submit_url = req.application_url + self.base_path + '/client_auth' 
    204211        c = {'client_name': client.name, 
     
    206213             'scope': scope, 
    207214             'submit_url': submit_url} 
    208         response = tmpl.generate(c=c).render('html') 
     215#        response = tmpl.generate(c=c).render('html') 
     216        response = self.renderer.render(self.client_authorization_form, c) 
    209217        start_response(self._get_http_status_string(httplib.OK), 
    210218           [('Content-type', 'text/html'), 
     
    273281        self.base_path = cls._get_config_option(prefix, local_conf, cls.BASE_URL_PATH_OPTION) 
    274282        self.client_register_file = cls._get_config_option(prefix, local_conf, cls.CLIENT_REGISTER_OPTION) 
     283        self.renderer_class = cls._get_config_option(prefix, local_conf, cls.RENDERER_CLASS_OPTION) 
    275284        self.session_env_key = cls._get_config_option(prefix, local_conf, cls.SESSION_KEY_OPTION) 
    276285        self.client_authorization_form = cls._get_config_option(prefix, local_conf, cls.CLIENT_AUTHORIZATION_FORM_OPTION) 
  • trunk/ndg_oauth/ndg_oauth_server/ndg/oauth/server/wsgi/oauth2_server.py

    r8004 r8030  
    1515from webob import Request 
    1616 
    17 from ndgoauthserver.lib.access_token.bearer_token_generator import BearerTokenGenerator 
    18 from ndgoauthserver.lib.access_token.myproxy_cert_token_generator import MyProxyCertTokenGenerator 
    19 from ndgoauthserver.lib.authenticate.certificate_client_authenticator import CertificateClientAuthenticator 
    20 from ndgoauthserver.lib.authenticate.noop_client_authenticator import NoopClientAuthenticator 
    21 from ndgoauthserver.lib.authorization_server import AuthorizationServer 
    22 from ndgoauthserver.lib.authorize.authorizer import Authorizer 
    23 from ndgoauthserver.lib.authorize.authorizer_storing_identifier import AuthorizerStoringIdentifier 
     17from ndg.oauth.server.lib.access_token.bearer_token_generator import BearerTokenGenerator 
     18from ndg.oauth.server.lib.access_token.myproxy_cert_token_generator import MyProxyCertTokenGenerator 
     19from ndg.oauth.server.lib.authenticate.certificate_client_authenticator import CertificateClientAuthenticator 
     20from ndg.oauth.server.lib.authenticate.noop_client_authenticator import NoopClientAuthenticator 
     21from ndg.oauth.server.lib.authorization_server import AuthorizationServer 
     22from ndg.oauth.server.lib.authorize.authorizer import Authorizer 
     23from ndg.oauth.server.lib.authorize.authorizer_storing_identifier import AuthorizerStoringIdentifier 
    2424 
    2525log = logging.getLogger(__name__) 
     
    3434    o MyProxyClientMiddleware 
    3535    o Middleware to set user's decisions for authorization of OAuth clients in 
    36       the environ, e.g., ndgoauthserver.wsgi.authorization_filter. 
     36      the environ, e.g., ndg.oauth.server.wsgi.authorization_filter. 
    3737    """ 
    3838    PARAM_PREFIX = 'oauth2server.' 
  • trunk/ndg_oauth/ndg_oauth_server/setup.cfg

    r8004 r8030  
    22#tag_build = dev 
    33tag_svn_revision = true 
    4  
    5 [easy_install] 
    6 find_links = http://www.pylonshq.com/download/ 
    7  
    8 [nosetests] 
    9 with-pylons = test.ini 
    10  
    11 # Babel configuration 
    12 [compile_catalog] 
    13 domain = ndgoauthserver 
    14 directory = ndgoauthserver/i18n 
    15 statistics = true 
    16  
    17 [extract_messages] 
    18 add_comments = TRANSLATORS: 
    19 output_file = ndgoauthserver/i18n/ndgoauthserver.pot 
    20 width = 80 
    21  
    22 [init_catalog] 
    23 domain = ndgoauthserver 
    24 input_file = ndgoauthserver/i18n/ndgoauthserver.pot 
    25 output_dir = ndgoauthserver/i18n 
    26  
    27 [update_catalog] 
    28 domain = ndgoauthserver 
    29 input_file = ndgoauthserver/i18n/ndgoauthserver.pot 
    30 output_dir = ndgoauthserver/i18n 
    31 previous = true 
  • trunk/ndg_oauth/ndg_oauth_server/setup.py

    r8026 r8030  
     1__author__ = "R B Wilkinson" 
     2__date__ = "29/02/12" 
     3__copyright__ = "(C) 2012 Science and Technology Facilities Council" 
     4__license__ = "BSD - see LICENSE file in top-level directory" 
     5__contact__ = "Philip.Kershaw@stfc.ac.uk" 
     6__revision__ = "$Id$" 
     7 
    18try: 
    29    from setuptools import setup, find_packages 
     
    613    from setuptools import setup, find_packages 
    714 
     15_long_description = """\ 
     16This is an OAuth 2.0 server library and WSGI middleware filter. 
     17 
     18Prerequisites 
     19============= 
     20This has been developed and tested for Python 2.6. 
     21 
     22Installation 
     23============ 
     24Installation can be performed using easy_install or pip.   
     25 
     26Configuration 
     27============= 
     28An example of configuration is provided in the file development.ini. This 
     29configures the components needed to authenticate users, obtain user 
     30authorisation for an OAuth client and obtain a certificate to use as an access 
     31token using MyProxyClient. 
     32""" 
     33 
    834setup( 
    9     name='ndgoauthserver', 
    10     version='0.1.1', 
    11     description='OAuth 2.0 server providing MyProxy certificates as access tokens', 
    12     author='R. B. Wilkinson', 
    13     #author_email='', 
    14     #url='', 
    15     install_requires=[ 
    16         "Pylons>=1.0", 
    17         "Genshi>=0.4", 
     35    name =                      'ndg_oauth_server', 
     36    version =                   '0.2.0', 
     37    description =               'OAuth 2.0 server providing MyProxy certificates as access tokens', 
     38    long_description =          _long_description, 
     39    author =                    'R. B. Wilkinson', 
     40    maintainer =                'Philip Kershaw', 
     41    maintainer_email =          'Philip.Kershaw@stfc.ac.uk', 
     42    #url ='', 
     43    license =                   'BSD - See LICENCE file for details', 
     44    install_requires =[ 
     45        "PasteScript", 
     46        "Beaker", 
     47        "WebOb", 
     48        "repoze.who", 
     49        "MyProxyWebService", 
     50        "Genshi", 
    1851    ], 
    19     setup_requires=["PasteScript>=1.6.3"], 
    20     packages=find_packages(exclude=['ez_setup']), 
    21     include_package_data=True, 
    22     test_suite='nose.collector', 
    23     package_data={'ndgoauthserver': ['i18n/*/LC_MESSAGES/*.mo']}, 
    24     #message_extractors={'ndgoauthserver': [ 
    25     #        ('**.py', 'python', None), 
    26     #        ('public/**', 'ignore', None)]}, 
    27     zip_safe=False, 
    28     paster_plugins=['PasteScript', 'Pylons'], 
    29     entry_points=""" 
    30     [paste.app_factory] 
    31     main = ndgoauthserver.config.middleware:make_app 
    32  
    33     [paste.app_install] 
    34     main = pylons.util:PylonsInstaller 
    35     """, 
     52    packages =find_packages(), 
     53    zip_safe =False, 
    3654) 
Note: See TracChangeset for help on using the changeset viewer.