class SecureValidationController(wsgi.Controller): """Controller for Tenant related operations""" # pylint: disable=W0231 def __init__(self): self.token_controller = TokenController() logger.info("Initializing Secure Token Validation extension") def handle_validate_request(self, req): token_id = req.headers.get("X-Subject-Token") return self.token_controller.validate_token(req=req, token_id=token_id) def handle_endpoints_request(self, req): token_id = req.headers.get("X-Subject-Token") return self.token_controller.endpoints(req=req, token_id=token_id)
def map_extension_methods(self, mapper, options): token_controller = TokenController(options) # Token Operations mapper.connect("/tokens/{token_id}", controller=token_controller, action="validate_token", conditions=dict(method=["GET"])) mapper.connect("/tokens/{tenant_id}", controller=token_controller, action="check_token", conditions=dict(method=["HEAD"]))
def __init__(self): mapper = routes.Mapper() # Token Operations auth_controller = TokenController() mapper.connect("/tokens", controller=auth_controller, action="authenticate", conditions=dict(method=["POST"])) # TODO(zns): this should be deprecated mapper.connect("/ec2tokens", controller=auth_controller, action="authenticate_ec2", conditions=dict(method=["POST"])) tenant_controller = TenantController(True) mapper.connect("/tenants", controller=tenant_controller, action="get_tenants", conditions=dict(method=["GET"])) # Miscellaneous Operations version_controller = VersionController() mapper.connect("/", controller=version_controller, action="get_version_info", file="service/version", conditions=dict(method=["GET"])) extensions_controller = ExtensionsController(True) mapper.connect("/extensions", controller=extensions_controller, action="get_extensions_info", conditions=dict(method=["GET"])) # Static Files Controller static_files_controller = StaticFilesController() mapper.connect("/identitydevguide.pdf", controller=static_files_controller, action="get_pdf_contract", root="content/service/", pdf="identitydevguide.pdf", conditions=dict(method=["GET"])) mapper.connect("/identity.wadl", controller=static_files_controller, action="get_wadl_contract", root="content/service/", wadl="identity.wadl", conditions=dict(method=["GET"])) mapper.connect("/common.ent", controller=static_files_controller, action="get_wadl_contract", wadl="common.ent", root="content/common/", conditions=dict(method=["GET"])) mapper.connect("/xslt/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/xslt/", mimetype="application/xml", conditions=dict(method=["GET"])) mapper.connect("/style/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/style/", mimetype="application/css", conditions=dict(method=["GET"])) mapper.connect("/js/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/js/", mimetype="application/javascript", conditions=dict(method=["GET"])) mapper.connect("/samples/{file:.*}", controller=static_files_controller, action="get_static_file", path="common/samples/", conditions=dict(method=["GET"])) mapper.connect("/xsd/{xsd:.*}", controller=static_files_controller, action="get_xsd_contract", root="content/common/", conditions=dict(method=["GET"])) mapper.connect("/xsd/atom/{xsd}", controller=static_files_controller, action="get_xsd_atom_contract", root="content/common/", conditions=dict(method=["GET"])) mapper.connect("/xsd/atom/{xsd}", controller=static_files_controller, action="get_xsd_atom_contract", root="content/common/", conditions=dict(method=["GET"])) super(ServiceApi, self).__init__(mapper)
def __init__(self, options): self.options = options logger.debug("Init with options=%s" % options) mapper = routes.Mapper() # Token Operations auth_controller = TokenController(options) mapper.connect("/tokens", controller=auth_controller, action="authenticate", conditions=dict(method=["POST"])) mapper.connect("/tokens/{token_id}", controller=auth_controller, action="validate_token", conditions=dict(method=["GET"])) mapper.connect("/tokens/{token_id}", controller=auth_controller, action="check_token", conditions=dict(method=["HEAD"])) # Do we need this.API doesn't have delete token. 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"])) # Tenant Operations tenant_controller = TenantController(options) mapper.connect("/tenants", controller=tenant_controller, action="get_tenants", conditions=dict(method=["GET"])) mapper.connect("/tenants/{tenant_id}", controller=tenant_controller, action="get_tenant", conditions=dict(method=["GET"])) roles_controller = RolesController(options) mapper.connect("/tenants/{tenant_id}/users/{user_id}/roles", controller=roles_controller, action="get_user_roles", conditions=dict(method=["GET"])) # User Operations user_controller = UserController(options) mapper.connect("/users/{user_id}", controller=user_controller, action="get_user", conditions=dict(method=["GET"])) mapper.connect("/users/{user_id}/roles", controller=roles_controller, action="get_user_roles", conditions=dict(method=["GET"])) # Miscellaneous Operations version_controller = VersionController(options) mapper.connect("/", controller=version_controller, action="get_version_info", file="admin/version", conditions=dict(method=["GET"])) extensions_controller = ExtensionsController(options) mapper.connect("/extensions", controller=extensions_controller, action="get_extensions_info", conditions=dict(method=["GET"])) # Static Files Controller static_files_controller = StaticFilesController(options) mapper.connect("/identityadminguide.pdf", controller=static_files_controller, action="get_pdf_contract", root="content/admin/", pdf="identityadminguide.pdf", conditions=dict(method=["GET"])) mapper.connect("/identity-admin.wadl", controller=static_files_controller, action="get_wadl_contract", root="content/admin/", wadl="identity-admin.wadl", conditions=dict(method=["GET"])) mapper.connect("/common.ent", controller=static_files_controller, action="get_wadl_contract", root="content/common/", wadl="common.ent", conditions=dict(method=["GET"])) mapper.connect("/xsd/{xsd}", controller=static_files_controller, action="get_xsd_contract", root="content/common/", conditions=dict(method=["GET"])) mapper.connect("/xsd/atom/{xsd}", controller=static_files_controller, action="get_xsd_atom_contract", root="content/common/", conditions=dict(method=["GET"])) mapper.connect("/xslt/{file:.*}", controller=static_files_controller, action="get_static_file", root="content/common/", path="xslt/", mimetype="application/xml", conditions=dict(method=["GET"])) mapper.connect("/js/{file:.*}", controller=static_files_controller, action="get_static_file", root="content/common/", path="js/", mimetype="application/javascript", conditions=dict(method=["GET"])) mapper.connect("/style/{file:.*}", controller=static_files_controller, action="get_static_file", root="content/common/", path="style/", mimetype="application/css", conditions=dict(method=["GET"])) mapper.connect("/samples/{file:.*}", controller=static_files_controller, action="get_static_file", root="content/common/", path="samples/", conditions=dict(method=["GET"])) extension.get_extension_configurer().configure(mapper, options) super(AdminApi, self).__init__(mapper)
def __init__(self): self.token_controller = TokenController() logger.info("Initializing Secure Token Validation extension")