Example #1
0
    def add_routes(self, mapper):
        # This is needed for dependency injection
        # it loads the Federation driver which registers it as a dependency.
        federation.Manager()
        auth_controller = controllers.Auth()
        idp_controller = controllers.IdentityProvider()
        protocol_controller = controllers.FederationProtocol()
        mapping_controller = controllers.MappingController()
        project_controller = controllers.ProjectV3()
        domain_controller = controllers.DomainV3()

        # Identity Provider CRUD operations

        self._add_resource(
            mapper,
            idp_controller,
            path=self._construct_url('identity_providers/{idp_id}'),
            get_action='get_identity_provider',
            put_action='create_identity_provider',
            patch_action='update_identity_provider',
            delete_action='delete_identity_provider')
        self._add_resource(mapper,
                           idp_controller,
                           path=self._construct_url('identity_providers'),
                           get_action='list_identity_providers')

        # Protocol CRUD operations

        self._add_resource(mapper,
                           protocol_controller,
                           path=self._construct_url(
                               'identity_providers/{idp_id}/protocols/'
                               '{protocol_id}'),
                           get_action='get_protocol',
                           put_action='create_protocol',
                           patch_action='update_protocol',
                           delete_action='delete_protocol')
        self._add_resource(
            mapper,
            protocol_controller,
            path=self._construct_url('identity_providers/{idp_id}/protocols'),
            get_action='list_protocols')

        # Mapping CRUD operations

        self._add_resource(mapper,
                           mapping_controller,
                           path=self._construct_url('mappings/{mapping_id}'),
                           get_action='get_mapping',
                           put_action='create_mapping',
                           patch_action='update_mapping',
                           delete_action='delete_mapping')
        self._add_resource(mapper,
                           mapping_controller,
                           path=self._construct_url('mappings'),
                           get_action='list_mappings')
        self._add_resource(mapper,
                           domain_controller,
                           path=self._construct_url('domains'),
                           get_action='list_domains_for_groups')
        self._add_resource(mapper,
                           project_controller,
                           path=self._construct_url('projects'),
                           get_action='list_projects_for_groups')
        self._add_resource(mapper,
                           auth_controller,
                           path=self._construct_url(
                               'identity_providers/{identity_provider}/'
                               'protocols/{protocol}/auth'),
                           get_post_action='federated_authentication')
Example #2
0
    def add_routes(self, mapper):
        # This is needed for dependency injection
        # it loads the Federation driver which registers it as a dependency.
        federation.Manager()
        idp_controller = controllers.IdentityProvider()
        protocol_controller = controllers.FederationProtocol()
        mapping_controller = controllers.MappingController()
        project_controller = controllers.ProjectV3()
        domain_controller = controllers.DomainV3()

        # Identity Provider CRUD operations

        mapper.connect(self._construct_url('identity_providers/{idp_id}'),
                       controller=idp_controller,
                       action='create_identity_provider',
                       conditions=dict(method=['PUT']))

        mapper.connect(self._construct_url('identity_providers'),
                       controller=idp_controller,
                       action='list_identity_providers',
                       conditions=dict(method=['GET']))

        mapper.connect(self._construct_url('identity_providers/{idp_id}'),
                       controller=idp_controller,
                       action='get_identity_provider',
                       conditions=dict(method=['GET']))

        mapper.connect(self._construct_url('identity_providers/{idp_id}'),
                       controller=idp_controller,
                       action='delete_identity_provider',
                       conditions=dict(method=['DELETE']))

        mapper.connect(self._construct_url('identity_providers/{idp_id}'),
                       controller=idp_controller,
                       action='update_identity_provider',
                       conditions=dict(method=['PATCH']))

        # Protocol CRUD operations

        mapper.connect(self._construct_url('identity_providers/{idp_id}/'
                                           'protocols/{protocol_id}'),
                       controller=protocol_controller,
                       action='create_protocol',
                       conditions=dict(method=['PUT']))

        mapper.connect(self._construct_url('identity_providers/{idp_id}/'
                                           'protocols/{protocol_id}'),
                       controller=protocol_controller,
                       action='update_protocol',
                       conditions=dict(method=['PATCH']))

        mapper.connect(self._construct_url('identity_providers/{idp_id}/'
                                           'protocols/{protocol_id}'),
                       controller=protocol_controller,
                       action='get_protocol',
                       conditions=dict(method=['GET']))

        mapper.connect(self._construct_url('identity_providers/{idp_id}/'
                                           'protocols'),
                       controller=protocol_controller,
                       action='list_protocols',
                       conditions=dict(method=['GET']))

        mapper.connect(self._construct_url('identity_providers/{idp_id}/'
                                           'protocols/{protocol_id}'),
                       controller=protocol_controller,
                       action='delete_protocol',
                       conditions=dict(method=['DELETE']))

        # Mapping CRUD operations

        mapper.connect(self._construct_url('mappings/{mapping_id}'),
                       controller=mapping_controller,
                       action='create_mapping',
                       conditions=dict(method=['PUT']))

        mapper.connect(self._construct_url('mappings'),
                       controller=mapping_controller,
                       action='list_mappings',
                       conditions=dict(method=['GET']))

        mapper.connect(self._construct_url('mappings/{mapping_id}'),
                       controller=mapping_controller,
                       action='get_mapping',
                       conditions=dict(method=['GET']))

        mapper.connect(self._construct_url('mappings/{mapping_id}'),
                       controller=mapping_controller,
                       action='delete_mapping',
                       conditions=dict(method=['DELETE']))

        mapper.connect(self._construct_url('mappings/{mapping_id}'),
                       controller=mapping_controller,
                       action='update_mapping',
                       conditions=dict(method=['PATCH']))

        mapper.connect(self._construct_url('domains'),
                       controller=domain_controller,
                       action='list_domains_for_groups',
                       conditions=dict(method=['GET']))

        mapper.connect(self._construct_url('projects'),
                       controller=project_controller,
                       action='list_projects_for_groups',
                       conditions=dict(method=['GET']))
    def add_routes(self, mapper):
        # This is needed for dependency injection
        # it loads the Federation driver which registers it as a dependency.
        federation.Manager()
        auth_controller = controllers.Auth()
        idp_controller = controllers.IdentityProvider()
        protocol_controller = controllers.FederationProtocol()
        mapping_controller = controllers.MappingController()
        project_controller = controllers.ProjectV3()
        domain_controller = controllers.DomainV3()
        saml_metadata_controller = controllers.SAMLMetadataV3()

        # Identity Provider CRUD operations

        self._add_resource(
            mapper,
            idp_controller,
            path=self._construct_url('identity_providers/{idp_id}'),
            get_action='get_identity_provider',
            put_action='create_identity_provider',
            patch_action='update_identity_provider',
            delete_action='delete_identity_provider',
            rel=build_resource_relation(resource_name='identity_provider'),
            path_vars={
                'idp_id': IDP_ID_PARAMETER_RELATION,
            })
        self._add_resource(
            mapper,
            idp_controller,
            path=self._construct_url('identity_providers'),
            get_action='list_identity_providers',
            rel=build_resource_relation(resource_name='identity_providers'))

        # Protocol CRUD operations

        self._add_resource(mapper,
                           protocol_controller,
                           path=self._construct_url(
                               'identity_providers/{idp_id}/protocols/'
                               '{protocol_id}'),
                           get_action='get_protocol',
                           put_action='create_protocol',
                           patch_action='update_protocol',
                           delete_action='delete_protocol',
                           rel=build_resource_relation(
                               resource_name='identity_provider_protocol'),
                           path_vars={
                               'idp_id': IDP_ID_PARAMETER_RELATION,
                               'protocol_id': PROTOCOL_ID_PARAMETER_RELATION,
                           })
        self._add_resource(
            mapper,
            protocol_controller,
            path=self._construct_url('identity_providers/{idp_id}/protocols'),
            get_action='list_protocols',
            rel=build_resource_relation(
                resource_name='identity_provider_protocols'),
            path_vars={
                'idp_id': IDP_ID_PARAMETER_RELATION,
            })

        # Mapping CRUD operations

        self._add_resource(
            mapper,
            mapping_controller,
            path=self._construct_url('mappings/{mapping_id}'),
            get_action='get_mapping',
            put_action='create_mapping',
            patch_action='update_mapping',
            delete_action='delete_mapping',
            rel=build_resource_relation(resource_name='mapping'),
            path_vars={
                'mapping_id':
                build_parameter_relation(parameter_name='mapping_id'),
            })
        self._add_resource(
            mapper,
            mapping_controller,
            path=self._construct_url('mappings'),
            get_action='list_mappings',
            rel=build_resource_relation(resource_name='mappings'))
        self._add_resource(
            mapper,
            domain_controller,
            path=self._construct_url('domains'),
            get_action='list_domains_for_groups',
            rel=build_resource_relation(resource_name='domains'))
        self._add_resource(
            mapper,
            project_controller,
            path=self._construct_url('projects'),
            get_action='list_projects_for_groups',
            rel=build_resource_relation(resource_name='projects'))
        self._add_resource(
            mapper,
            auth_controller,
            path=self._construct_url('identity_providers/{identity_provider}/'
                                     'protocols/{protocol}/auth'),
            get_post_action='federated_authentication',
            rel=build_resource_relation(
                resource_name='identity_provider_protocol_auth'),
            path_vars={
                'identity_provider': IDP_ID_PARAMETER_RELATION,
                'protocol': PROTOCOL_ID_PARAMETER_RELATION,
            })

        # Auth operations
        self._add_resource(mapper,
                           auth_controller,
                           path='/auth' + self._construct_url('saml2'),
                           post_action='create_saml_assertion',
                           rel=build_resource_relation(resource_name='saml2'))

        # Keystone-Identity-Provider metadata endpoint
        self._add_resource(
            mapper,
            saml_metadata_controller,
            path=self._construct_url('saml2/metadata'),
            get_action='get_metadata',
            rel=build_resource_relation(resource_name='metadata'))