Exemplo n.º 1
0
    def add_routes(self, mapper):
        auth_controller = controllers.Auth()
        idp_controller = controllers.IdentityProvider()
        protocol_controller = controllers.FederationProtocol()
        mapping_controller = controllers.MappingController()
        project_controller = controllers.ProjectAssignmentV3()
        domain_controller = controllers.DomainV3()
        saml_metadata_controller = controllers.SAMLMetadataV3()
        sp_controller = controllers.ServiceProvider()

        # 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'))

        # Service Providers CRUD operations

        self._add_resource(
            mapper,
            sp_controller,
            path=self._construct_url('service_providers/{sp_id}'),
            get_action='get_service_provider',
            put_action='create_service_provider',
            patch_action='update_service_provider',
            delete_action='delete_service_provider',
            rel=build_resource_relation(resource_name='service_provider'),
            path_vars={
                'sp_id': SP_ID_PARAMETER_RELATION,
            })

        self._add_resource(
            mapper,
            sp_controller,
            path=self._construct_url('service_providers'),
            get_action='list_service_providers',
            rel=build_resource_relation(resource_name='service_providers'))

        self._add_resource(
            mapper,
            domain_controller,
            path=self._construct_url('domains'),
            new_path='/auth/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'),
            new_path='/auth/projects',
            get_action='list_projects_for_groups',
            rel=build_resource_relation(resource_name='projects'))

        # Auth operations
        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,
            })
        self._add_resource(mapper,
                           auth_controller,
                           path='/auth' + self._construct_url('saml2'),
                           post_action='create_saml_assertion',
                           rel=build_resource_relation(resource_name='saml2'))
        self._add_resource(mapper,
                           auth_controller,
                           path='/auth' + self._construct_url('saml2/ecp'),
                           post_action='create_ecp_assertion',
                           rel=build_resource_relation(resource_name='ecp'))
        self._add_resource(mapper,
                           auth_controller,
                           path='/auth' +
                           self._construct_url('websso/{protocol_id}'),
                           get_post_action='federated_sso_auth',
                           rel=build_resource_relation(resource_name='websso'),
                           path_vars={
                               'protocol_id': PROTOCOL_ID_PARAMETER_RELATION,
                           })
        self._add_resource(
            mapper,
            auth_controller,
            path='/auth' + self._construct_url(
                'identity_providers/{idp_id}/protocols/{protocol_id}/websso'),
            get_post_action='federated_idp_specific_sso_auth',
            rel=build_resource_relation(resource_name='identity_providers'),
            path_vars={
                'idp_id': IDP_ID_PARAMETER_RELATION,
                'protocol_id': PROTOCOL_ID_PARAMETER_RELATION,
            })

        # 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'))
Exemplo n.º 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()
        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

        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']))

        mapper.connect(
            self._construct_url('identity_providers/'
                                '{identity_provider}/protocols/'
                                '{protocol}/auth'),
            controller=auth_controller,
            action='federated_authentication',
            conditions=dict(method=['GET', 'POST']))
Exemplo n.º 3
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')
Exemplo n.º 4
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()
        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'))