Esempio n. 1
0
def initialize_drivers():
    DRIVERS['catalog_api'] = catalog.Manager()
    DRIVERS['credential_api'] = credential.Manager()
    DRIVERS['identity_api'] = identity.Manager()
    DRIVERS['policy_api'] = policy.Manager()
    DRIVERS['token_api'] = token.Manager()
    DRIVERS['trust_api'] = trust.Manager()
    return DRIVERS
 def setUp(self):
     super(MemcacheTokenCacheInvalidation, self).setUp()
     CONF.token.driver = 'keystone.token.backends.memcache.Token'
     self.load_backends()
     fake_client = MemcacheClient()
     self.token_man = token.Manager()
     self.token_man.driver = token_memcache.Token(client=fake_client)
     self.token_api = self.token_man
     self.token_provider_api.driver.token_api = self.token_api
     self._create_test_data()
 def setUp(self):
     super(MemcacheToken, self).setUp()
     # Use the memcache backend for the token driver.
     self.opt_in_group('token',
                       driver='keystone.token.backends.memcache.Token')
     self.load_backends()
     # Override the memcache client with the "dummy" client.
     fake_client = MemcacheClient()
     self.token_man = token.Manager()
     self.token_man.driver = token_memcache.Token(client=fake_client)
     self.token_api = self.token_man
Esempio n. 4
0
    def setUp(self):
        super(SqlTests, self).setUp()
        self.config([
            test.etcdir('keystone.conf.sample'),
            test.testsdir('test_overrides.conf'),
            test.testsdir('backend_sql.conf')
        ])

        # initialize managers and override drivers
        self.catalog_man = catalog.Manager()
        self.identity_man = identity.Manager()
        self.token_man = token.Manager()

        # create shortcut references to each driver
        self.catalog_api = self.catalog_man.driver
        self.identity_api = self.identity_man.driver
        self.token_api = self.token_man.driver

        # populate the engine with tables & fixtures
        self.load_fixtures(default_fixtures)
Esempio n. 5
0
def load_backends():

    # Configure and build the cache
    cache.configure_cache_region(cache.REGION)

    # Ensure that the identity driver is created before the assignment manager.
    # The default assignment driver is determined by the identity driver, so
    # the identity driver must be available to the assignment manager.
    _IDENTITY_API = identity.Manager()

    DRIVERS = dict(assignment_api=assignment.Manager(),
                   catalog_api=catalog.Manager(),
                   credential_api=credential.Manager(),
                   endpoint_filter_api=endpoint_filter.Manager(),
                   identity_api=_IDENTITY_API,
                   policy_api=policy.Manager(),
                   token_api=token.Manager(),
                   trust_api=trust.Manager(),
                   token_provider_api=token.provider.Manager())

    return DRIVERS
Esempio n. 6
0
from keystone import credential
from keystone import identity
from keystone import policy
from keystone import routers
from keystone import token
from keystone import trust

CONF = config.CONF
LOG = logging.getLogger(__name__)

DRIVERS = dict(catalog_api=catalog.Manager(),
               credentials_api=credential.Manager(),
               ec2_api=ec2.Manager(),
               identity_api=identity.Manager(),
               policy_api=policy.Manager(),
               token_api=token.Manager(),
               trust_api=trust.Manager())


@logging.fail_gracefully
def public_app_factory(global_conf, **local_conf):
    controllers.register_version('v2.0')
    conf = global_conf.copy()
    conf.update(local_conf)
    return wsgi.ComposingRouter(routes.Mapper(), [
        identity.routers.Public(),
        token.routers.Router(),
        routers.VersionV2('public'),
        routers.Extension(False)
    ])
Esempio n. 7
0
 def __init__(self):
     self.identity_api = Manager()
     self.token_api = token.Manager()
     self.policy_api = policy.Manager()
     super(RoleController, self).__init__()
Esempio n. 8
0
 def main(cls):
     token_manager = token.Manager()
     token_manager.driver.flush_expired_tokens()
Esempio n. 9
0
 def __init__(self):
     self.catalog_api = Manager()
     self.identity_api = identity.Manager()
     self.policy_api = policy.Manager()
     self.token_api = token.Manager()
     super(EndpointController, self).__init__()
Esempio n. 10
0
 def __init__(self):
     self.token_api = token.Manager()
Esempio n. 11
0
    def __init__(self):
        mapper = routes.Mapper()

        apis = dict(catalog_api=catalog.Manager(),
                    identity_api=identity.Manager(),
                    policy_api=policy.Manager(),
                    token_api=token.Manager())

        # Catalog

        self.crud_routes(mapper, catalog.ServiceControllerV3(**apis),
                         'services', 'service')

        self.crud_routes(mapper, catalog.EndpointControllerV3(**apis),
                         'endpoints', 'endpoint')

        # Identity

        self.crud_routes(mapper, identity.DomainControllerV3(**apis),
                         'domains', 'domain')

        project_controller = identity.ProjectControllerV3(**apis)
        self.crud_routes(mapper, project_controller, 'projects', 'project')
        mapper.connect('/users/{user_id}/projects',
                       controller=project_controller,
                       action='list_user_projects',
                       conditions=dict(method=['GET']))

        self.crud_routes(mapper, identity.UserControllerV3(**apis), 'users',
                         'user')

        self.crud_routes(mapper, identity.CredentialControllerV3(**apis),
                         'credentials', 'credential')

        role_controller = identity.RoleControllerV3(**apis)
        self.crud_routes(mapper, role_controller, 'roles', 'role')
        mapper.connect(
            '/projects/{project_id}/users/{user_id}/roles/{role_id}',
            controller=role_controller,
            action='create_grant',
            conditions=dict(method=['PUT']))
        mapper.connect(
            '/projects/{project_id}/users/{user_id}/roles/{role_id}',
            controller=role_controller,
            action='check_grant',
            conditions=dict(method=['HEAD']))
        mapper.connect('/projects/{project_id}/users/{user_id}/roles',
                       controller=role_controller,
                       action='list_grants',
                       conditions=dict(method=['GET']))
        mapper.connect(
            '/projects/{project_id}/users/{user_id}/roles/{role_id}',
            controller=role_controller,
            action='revoke_grant',
            conditions=dict(method=['DELETE']))
        mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',
                       controller=role_controller,
                       action='create_grant',
                       conditions=dict(method=['PUT']))
        mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',
                       controller=role_controller,
                       action='check_grant',
                       conditions=dict(method=['HEAD']))
        mapper.connect('/domains/{domain_id}/users/{user_id}/roles',
                       controller=role_controller,
                       action='list_grants',
                       conditions=dict(method=['GET']))
        mapper.connect('/domains/{domain_id}/users/{user_id}/roles/{role_id}',
                       controller=role_controller,
                       action='revoke_grant',
                       conditions=dict(method=['DELETE']))

        # Policy

        policy_controller = policy.PolicyControllerV3(**apis)
        self.crud_routes(mapper, policy_controller, 'policies', 'policy')

        # Token
        """
        # v2.0 LEGACY
        mapper.connect('/tokens/{token_id}',
                       controller=auth_controller,
                       action='validate_token',
                       conditions=dict(method=['GET']))
        mapper.connect('/tokens/{token_id}',
                       controller=auth_controller,
                       action='validate_token_head',
                       conditions=dict(method=['HEAD']))
        mapper.connect('/tokens/{token_id}',
                       controller=auth_controller,
                       action='delete_token',
                       conditions=dict(method=['DELETE']))
        mapper.connect('/tokens/{token_id}/endpoints',
                       controller=auth_controller,
                       action='endpoints',
                       conditions=dict(method=['GET']))
        """

        super(V3Router, self).__init__(mapper, [])
Esempio n. 12
0
 def setUp(self):
     super(MemcacheToken, self).setUp()
     fake_client = MemcacheClient()
     self.token_man = token.Manager()
     self.token_man.driver = token_memcache.Token(client=fake_client)
     self.token_api = self.token_man