From 7e4d3560d40bbbdef450c29d48168a7a4850e108 Mon Sep 17 00:00:00 2001 From: "michael.dong@rackspace.com" Date: Wed, 19 Aug 2015 15:48:50 -0500 Subject: [PATCH] added license and changed rax-auth extension to identity --- scripts/fuzzdbGen.py | 16 + syntribos/__init__.py | 16 + syntribos/arguments.py | 16 + syntribos/clients/__init__.py | 16 + syntribos/clients/http.py | 16 + syntribos/config.py | 16 + syntribos/extensions/__init__.py | 16 + syntribos/extensions/identity/__init__.py | 16 + .../{rax_auth => identity}/auth_config.py | 20 +- .../{rax_auth => identity}/client.py | 16 + .../extensions/identity/models/__init__.py | 16 + .../models/auth_models.py | 306 +++++++++--------- syntribos/extensions/random_data/__init__.py | 16 + syntribos/extensions/random_data/client.py | 16 + syntribos/extensions/rax_auth/__init__.py | 0 .../extensions/rax_auth/models/__init__.py | 0 syntribos/runner.py | 16 + syntribos/tests/__init__.py | 16 + syntribos/tests/base.py | 16 + syntribos/tests/fuzz/__init__.py | 16 + syntribos/tests/fuzz/all_attacks.py | 16 + syntribos/tests/fuzz/base_fuzz.py | 16 + syntribos/tests/fuzz/config.py | 16 + syntribos/tests/fuzz/datagen.py | 16 + syntribos/tests/fuzz/integer_overflow.py | 16 + syntribos/tests/fuzz/ldap.py | 16 + syntribos/tests/fuzz/sql.py | 16 + syntribos/tests/request_creator.py | 16 + 28 files changed, 557 insertions(+), 153 deletions(-) create mode 100644 syntribos/extensions/identity/__init__.py rename syntribos/extensions/{rax_auth => identity}/auth_config.py (66%) rename syntribos/extensions/{rax_auth => identity}/client.py (83%) create mode 100644 syntribos/extensions/identity/models/__init__.py rename syntribos/extensions/{rax_auth => identity}/models/auth_models.py (51%) delete mode 100644 syntribos/extensions/rax_auth/__init__.py delete mode 100644 syntribos/extensions/rax_auth/models/__init__.py diff --git a/scripts/fuzzdbGen.py b/scripts/fuzzdbGen.py index a027cee2..3a085fb0 100644 --- a/scripts/fuzzdbGen.py +++ b/scripts/fuzzdbGen.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + import os import sys diff --git a/syntribos/__init__.py b/syntribos/__init__.py index e69de29b..94d152e4 100644 --- a/syntribos/__init__.py +++ b/syntribos/__init__.py @@ -0,0 +1,16 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + diff --git a/syntribos/arguments.py b/syntribos/arguments.py index ac3f9c91..0b60d990 100644 --- a/syntribos/arguments.py +++ b/syntribos/arguments.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + import os import sys import argparse diff --git a/syntribos/clients/__init__.py b/syntribos/clients/__init__.py index e69de29b..94d152e4 100644 --- a/syntribos/clients/__init__.py +++ b/syntribos/clients/__init__.py @@ -0,0 +1,16 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + diff --git a/syntribos/clients/http.py b/syntribos/clients/http.py index 9de5330c..6c60d0e1 100644 --- a/syntribos/clients/http.py +++ b/syntribos/clients/http.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from copy import deepcopy from importlib import import_module from uuid import uuid4 diff --git a/syntribos/config.py b/syntribos/config.py index af438af4..f4817a7a 100644 --- a/syntribos/config.py +++ b/syntribos/config.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from cafe.engine.models.data_interfaces import ConfigSectionInterface diff --git a/syntribos/extensions/__init__.py b/syntribos/extensions/__init__.py index e69de29b..94d152e4 100644 --- a/syntribos/extensions/__init__.py +++ b/syntribos/extensions/__init__.py @@ -0,0 +1,16 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + diff --git a/syntribos/extensions/identity/__init__.py b/syntribos/extensions/identity/__init__.py new file mode 100644 index 00000000..94d152e4 --- /dev/null +++ b/syntribos/extensions/identity/__init__.py @@ -0,0 +1,16 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + diff --git a/syntribos/extensions/rax_auth/auth_config.py b/syntribos/extensions/identity/auth_config.py similarity index 66% rename from syntribos/extensions/rax_auth/auth_config.py rename to syntribos/extensions/identity/auth_config.py index 6463c05d..12601d3b 100644 --- a/syntribos/extensions/rax_auth/auth_config.py +++ b/syntribos/extensions/identity/auth_config.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from cafe.engine.models.data_interfaces import ConfigSectionInterface @@ -28,10 +44,6 @@ class UserConfig(ConfigSectionInterface): def password(self): return self.get_raw("password") - @property - def api_key(self): - return self.get_raw("api_key") - @property def tenant_id(self): return self.get("tenant_id") diff --git a/syntribos/extensions/rax_auth/client.py b/syntribos/extensions/identity/client.py similarity index 83% rename from syntribos/extensions/rax_auth/client.py rename to syntribos/extensions/identity/client.py index 0f0e96eb..eeb90c5b 100644 --- a/syntribos/extensions/rax_auth/client.py +++ b/syntribos/extensions/identity/client.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from cafe.engine.behaviors import BaseBehavior from cafe.engine.http.client import AutoMarshallingHTTPClient diff --git a/syntribos/extensions/identity/models/__init__.py b/syntribos/extensions/identity/models/__init__.py new file mode 100644 index 00000000..94d152e4 --- /dev/null +++ b/syntribos/extensions/identity/models/__init__.py @@ -0,0 +1,16 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + diff --git a/syntribos/extensions/rax_auth/models/auth_models.py b/syntribos/extensions/identity/models/auth_models.py similarity index 51% rename from syntribos/extensions/rax_auth/models/auth_models.py rename to syntribos/extensions/identity/models/auth_models.py index a5675778..cc144f44 100644 --- a/syntribos/extensions/rax_auth/models/auth_models.py +++ b/syntribos/extensions/identity/models/auth_models.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + import json from xml.etree import ElementTree as ET from cafe.engine.models.base import ( @@ -12,14 +28,6 @@ class V2_0Constants(object): 'http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0' XML_NS_OS_KSEC2 = \ 'http://docs.openstack.org/identity/api/ext/OS-KSEC2/v1.0' - XML_NS_RAX_KSQA = \ - 'http://docs.rackspace.com/identity/api/ext/RAX-KSQA/v1.0' - XML_NS_RAX_KSKEY = \ - 'http://docs.rackspace.com/identity/api/ext/RAX-KSKEY/v1.0' - XML_NS_RAX_AUTH = \ - 'http://docs.rackspace.com/identity/api/ext/RAX-AUTH/v1.0' - XML_NS_RAX_KSGRP = \ - 'http://docs.rackspace.com/identity/api/ext/RAX-KSGRP/v1.0' XML_NS_ATOM = 'http://www.w3.org/2005/Atom' @@ -86,31 +94,31 @@ class EmptyModel(object): class AuthResponse(BaseIdentityModel): def __init__( - self, token=None, service_catalog=None, user=None): - super(AuthResponse, self).__init__(locals()) + self, token=None, service_catalog=None, user=None, metadata=None): + super(AuthResponse, self).__init__(locals()) @classmethod def _dict_to_obj(cls, data): return cls( - token=AuthResponseToken._dict_to_obj(data.get("token")), - user=User._dict_to_obj(data.get("user")), + token=AuthResponseToken._dict_to_obj(data.get('token')), + metadata=Metadata._dict_to_obj(data.get('metadata')), + user=User._dict_to_obj(data.get('user')), service_catalog=ServiceCatalog._dict_to_obj( - data.get("serviceCatalog"))) + data.get('serviceCatalog'))) @classmethod def _json_to_obj(cls, serialized_str): - data = json.loads(serialized_str) - return cls._dict_to_obj(data.get("access")) + data_dict = json.loads(serialized_str) + return cls._dict_to_obj(data_dict.get("access")) @classmethod - def _xml_ele_to_obj(cls, element): - service_catalog = ServiceCatalog._xml_ele_to_obj( - cls._find(element, "serviceCatalog")) + def _xml_ele_to_obj(cls, ele): return cls( - token=AuthResponseToken._xml_ele_to_obj( - cls._find(element, "token")), - user=User._xml_ele_to_obj(cls._find(element, "user")), - service_catalog=service_catalog) + token=AuthResponseToken._xml_ele_to_obj(ele.find('token')), + metadata=Metadata._xml_ele_to_obj(ele.find('metadata')), + user=User._xml_ele_to_obj(ele.find('user')), + service_catalog=ServiceCatalog._xml_ele_to_obj( + ele.find('serviceCatalog'))) def get_service(self, name): for service in self.service_catalog: @@ -119,51 +127,63 @@ class AuthResponse(BaseIdentityModel): return None +class Metadata(BaseIdentityModel): + + @classmethod + def _dict_to_obj(cls, data): + return data + + @classmethod + def _xml_ele_to_obj(cls, ele): + return ele.attrib + + class Tenant(BaseIdentityModel): - def __init__(self, name=None, id_=None): + def __init__(self, enabled=None, description=None, name=None, id_=None): super(Tenant, self).__init__(locals()) @classmethod def _xml_ele_to_obj(cls, element): - if element is None: - return cls() - return cls( - name=element.attrib.get("name"), id_=element.attrib.get("id")) + if element.tag.lower() != "tenant": + raise Exception("wrong element") + enabled = True if element.attrib.get('enabled') == "true" else False + description = element.find('description') + description = "" if description is None else description.text + return cls(enabled=enabled, + description=description, + name=element.attrib.get('name'), + id_=element.attrib.get('id')) @classmethod - def _dict_to_obj(cls, data): - if data is None: - return cls() - return cls( - name=data.get("name"), id_=data.get("id")) + def _dict_to_obj(cls, data_dict): + return cls(description=data_dict.get('description'), + enabled=data_dict.get('enabled'), + id_=data_dict.get('id'), + name=data_dict.get('name')) @classmethod def _json_to_obj(cls, serialized_str): - data = json.loads(serialized_str) - return cls._dict_to_obj(data.get("tenant")) + data_dict = json.loads(serialized_str) + return cls._dict_to_obj(data_dict.get('tenant')) class AuthResponseToken(BaseIdentityModel): - def __init__( - self, id_=None, expires=None, tenant=None, authenticated_by=None): + def __init__(self, id_=None, issued_at=None, expires=None, tenant=None): super(AuthResponseToken, self).__init__(locals()) @classmethod def _dict_to_obj(cls, data): - return cls(id_=data.get("id"), - expires=data.get("expires"), - tenant=Tenant._dict_to_obj(data.get("tenant")), - authenticated_by=data.get("RAX-AUTH:authenticatedBy")) + return cls(id_=data.get('id'), + expires=data.get('expires'), + issued_at=data.get('issued_at'), + tenant=Tenant._dict_to_obj(data.get('tenant'))) @classmethod - def _xml_ele_to_obj(cls, element): - authenticated_by = cls._find(element, "authenticatedBy") - authenticated_by = authenticated_by.findtext("credential") - return cls( - id_=element.attrib.get("id"), - expires=element.attrib.get("expires"), - tenant=Tenant._xml_ele_to_obj(cls._find(element, "tenant")), - authenticated_by=authenticated_by) + def _xml_ele_to_obj(cls, ele): + return cls(id_=ele.attrib.get('id'), + expires=ele.attrib.get('expires'), + issued_at=ele.attrib.get('issued_at'), + tenant=Tenant._xml_ele_to_obj(ele.find('tenant'))) class ServiceCatalog(BaseIdentityListModel): @@ -181,36 +201,32 @@ class ServiceCatalog(BaseIdentityListModel): class User(BaseIdentityModel): def __init__( - self, id_=None, name=None, roles=None, - rax_auth_default_region=None, rax_auth_federated=None): + self, id_=None, name=None, username=None, roles=None, + roles_links=None): super(User, self).__init__(locals()) @classmethod def _dict_to_obj(cls, data): - if data is None: - return cls() - region = data.get("RAX-AUTH:defaultRegion") - if isinstance(region, list): - region = region[0] return cls( - id_=data.get("id"), - name=data.get("name"), - roles=Roles._dict_to_obj(data.get("roles")), - rax_auth_default_region=region, - rax_auth_federated=data.get("RAX-AUTH:federated")) + id_=data.get('id'), + name=data.get('name'), + username=data.get('username'), + roles=Roles._dict_to_obj(data.get('roles')), + roles_links=RolesLinks._dict_to_obj(data.get('roles_links'))) @classmethod - def _xml_ele_to_obj(cls, element): + def _xml_ele_to_obj(cls, ele): return cls( - id_=element.attrib.get("id"), - name=element.attrib.get("name"), - roles=Roles._xml_ele_to_obj(cls._find(element, "roles")), - rax_auth_default_region=element.attrib.get("defaultRegion"), - rax_auth_federated=element.attrib.get("federated")) + id_=ele.attrib.get('id'), + name=ele.attrib.get('name'), + username=ele.attrib.get('username'), + roles=Roles._xml_ele_to_obj(ele.findall('role')), + roles_links=RolesLinks._xml_ele_to_obj(ele.find('roles_links'))) class Service(BaseIdentityModel): - def __init__(self, endpoints=None, name=None, type_=None): + def __init__( + self, endpoints=None, endpoints_links=None, name=None, type_=None): super(Service, self).__init__(locals()) def get_endpoint(self, region): @@ -219,7 +235,7 @@ class Service(BaseIdentityModel): or None if such an endpoint is not found """ for endpoint in self.endpoints: - if getattr(endpoint, "region"): + if getattr(endpoint, 'region'): if str(endpoint.region).lower() == str(region).lower(): return endpoint return None @@ -227,16 +243,19 @@ class Service(BaseIdentityModel): @classmethod def _dict_to_obj(cls, data): return cls( - endpoints=Endpoints._dict_to_obj(data.get("endpoints")), - name=data.get("name"), type_=data.get("type")) + endpoints=Endpoints._dict_to_obj(data.get('endpoints')), + endpoints_links=EndpointsLinks._dict_to_obj( + data.get('endpoints_links')), + name=data.get('name'), type_=data.get('type')) @classmethod - def _xml_ele_to_obj(cls, element): + def _xml_ele_to_obj(cls, ele): return cls( - endpoints=Endpoints._xml_ele_to_obj( - element.findall("endpoint")), - name=element.attrib.get("name"), - type_=element.attrib.get("type")) + endpoints=Endpoints._xml_ele_to_obj(ele.findall("endpoint")), + endpoints_links=EndpointsLinks._xml_ele_to_obj( + ele.find('endpoints_links')), + name=ele.attrib.get('name'), + type_=ele.attrib.get('type')) class Endpoints(BaseIdentityListModel): @@ -258,44 +277,47 @@ class Endpoints(BaseIdentityListModel): return cls._dict_to_obj(data.get("endpoints")) +class EndpointsLinks(BaseIdentityListModel): + # always returns an empty list since no documentation on endpoint links + @classmethod + def _dict_to_obj(cls, data): + return EndpointsLinks() + + @classmethod + def _xml_ele_to_obj(cls, ele): + return EndpointsLinks() + + class Endpoint(BaseIdentityModel): - def __init__(self, id_=None, tenant_id=None, region=None, type_=None, - public_url=None, internal_url=None, admin_url=None, - version_id=None, version_info=None, version_list=None, - name=None): + def __init__( + self, region=None, id_=None, public_url=None, admin_url=None, + internal_url=None, private_url=None, version_id=None, + version_info=None, version_list=None): super(Endpoint, self).__init__(locals()) @classmethod - def _xml_ele_to_obj(cls, element): - version = element.find("version") - version_attrib = version.attrib if version is not None else {} - return cls( - id_=element.attrib.get("id"), - tenant_id=element.attrib.get("tenantId"), - region=element.attrib.get("region"), - type_=element.attrib.get("type"), - name=element.attrib.get("name"), - public_url=element.attrib.get("publicURL"), - internal_url=element.attrib.get("internalURL"), - admin_url=element.attrib.get("adminURL"), - version_id=version_attrib.get("id"), - version_info=version_attrib.get("info"), - version_list=version_attrib.get("list")) + def _dict_to_obj(cls, data): + return cls(region=data.get('region'), + id_=data.get('Id'), + public_url=data.get('publicURL'), + private_url=data.get('privateURL'), + admin_url=data.get('adminURL'), + internal_url=data.get('internalURL'), + version_id=data.get('versionId'), + version_info=data.get('versionInfo'), + version_list=data.get('versionList')) @classmethod - def _dict_to_obj(cls, data): - return cls( - id_=data.get("id"), - tenant_id=data.get("tenantId"), - region=data.get("region"), - type_=data.get("type"), - name=data.get("name"), - public_url=data.get("publicURL"), - internal_url=data.get("internalURL"), - admin_url=data.get("adminURL"), - version_id=data.get("versionId"), - version_info=data.get("versionInfo"), - version_list=data.get("versionList")) + def _xml_ele_to_obj(cls, ele): + return cls(region=ele.attrib.get('region'), + id_=ele.attrib.get('Id'), + public_url=ele.attrib.get('publicURL'), + private_url=ele.attrib.get('privateURL'), + admin_url=ele.attrib.get('adminURL'), + internal_url=ele.attrib.get('internalURL'), + version_id=ele.attrib.get('versionId'), + version_info=ele.attrib.get('versionInfo'), + version_list=ele.attrib.get('versionList')) class Roles(BaseIdentityListModel): @@ -310,6 +332,17 @@ class Roles(BaseIdentityListModel): return Roles([Role._dict_to_obj(obj) for obj in data]) +class RolesLinks(BaseIdentityListModel): + # always returns an empty list since no documentation on role links + @classmethod + def _dict_to_obj(cls, data): + return RolesLinks() + + @classmethod + def _xml_ele_to_obj(cls, data): + return RolesLinks() + + class Role(BaseIdentityModel): def __init__( self, id_=None, name=None, description=None, @@ -321,52 +354,40 @@ class Role(BaseIdentityModel): if element is None: return None return cls( - id_=element.attrib.get("id"), name=element.attrib.get("name"), - description=element.attrib.get("description"), - rax_auth_propagate=element.attrib.get("propagate"), - service_id=element.attrib.get("serviceId"), - tenant_id=element.attrib.get("tenantId")) + id_=element.attrib.get("id"), + name=element.attrib.get("name"), + description=element.attrib.get("description")) @classmethod def _dict_to_obj(cls, data): if data is None: return None return cls( - id_=data.get("id"), name=data.get("name"), - description=data.get("description"), - rax_auth_propagate=data.get("rax-auth:propagate"), - service_id=data.get("serviceId"), - tenant_id=data.get("tenantId")) + id_=data.get("id"), + name=data.get("name"), + description=data.get("description")) class Auth(BaseIdentityModel): - xmlns = V2_0Constants.XML_NS def __init__( - self, password_creds=None, token_creds=None, - api_key_creds=None, tenant_name=None, tenant_id=None): - password_creds = password_creds or EmptyModel() - token_creds = token_creds or EmptyModel() - api_key_creds = api_key_creds or EmptyModel() + self, username=None, password=None, tenant_name=None, + tenant_id=None, token=None): super(Auth, self).__init__(locals()) def _obj_to_dict(self): attrs = { "tenantName": self.tenant_name, "tenantId": self.tenant_id, - "passwordCredentials": self.password_creds._obj_to_dict(), - "RAX-KSKEY:apiKeyCredentials": self.api_key_creds._obj_to_dict(), - "token": self.token_creds._obj_to_dict()} + "passwordCredentials": self.password_credentials._obj_to_dict()} return {'auth': self._remove_empty_values(attrs)} def _obj_to_xml_ele(self): element = ET.Element('auth') element = self._set_xml_etree_element( - element, {"tenantName": self.tenant_name, "xmlns": self.xmlns, + element, {"tenantName": self.tenant_name, "tenantId": self.tenant_id}) - element.append(self.password_creds._obj_to_xml_ele()) - element.append(self.token_creds._obj_to_xml_ele()) - element.append(self.api_key_creds._obj_to_xml_ele()) + element.append(self.password_credentials._obj_to_xml_ele()) return element @@ -376,12 +397,16 @@ class PasswordCredentials(BaseIdentityModel): super(PasswordCredentials, self).__init__(locals()) def _obj_to_dict(self): - attrs = {"username": self.username, "password": self.password} + attrs = { + "username": self.username, + "password": self.password} return self._remove_empty_values(attrs) def _obj_to_xml_ele(self): element = ET.Element('passwordCredentials') - attrs = {"username": self.username, "password": self.password} + attrs = { + "username": self.username, + "password": self.password} return self._set_xml_etree_element(element, attrs) @@ -397,20 +422,3 @@ class Token(BaseIdentityModel): element = ET.Element('token') attrs = {"id": self.id_} return self._set_xml_etree_element(element, attrs) - - -class APIKeyCredentials(BaseIdentityModel): - def __init__(self, username=None, api_key=None): - xmlns = V2_0Constants.XML_NS_RAX_KSKEY - super(APIKeyCredentials, self).__init__(locals()) - - def _obj_to_dict(self): - attrs = {"username": self.username, "apiKey": self.api_key} - return self._remove_empty_values(attrs) - - def _obj_to_xml_ele(self): - element = ET.Element('apiKeyCredentials') - attrs = { - "username": self.username, "apiKey": self.api_key, - "xmlns": self.xmlns} - return self._set_xml_etree_element(element, attrs) diff --git a/syntribos/extensions/random_data/__init__.py b/syntribos/extensions/random_data/__init__.py index e69de29b..94d152e4 100644 --- a/syntribos/extensions/random_data/__init__.py +++ b/syntribos/extensions/random_data/__init__.py @@ -0,0 +1,16 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + diff --git a/syntribos/extensions/random_data/client.py b/syntribos/extensions/random_data/client.py index 645f4547..f3296bc3 100644 --- a/syntribos/extensions/random_data/client.py +++ b/syntribos/extensions/random_data/client.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + import uuid diff --git a/syntribos/extensions/rax_auth/__init__.py b/syntribos/extensions/rax_auth/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/syntribos/extensions/rax_auth/models/__init__.py b/syntribos/extensions/rax_auth/models/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/syntribos/runner.py b/syntribos/runner.py index be80b4f5..ba2ea2be 100644 --- a/syntribos/runner.py +++ b/syntribos/runner.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from __future__ import print_function from unittest.runner import _WritelnDecorator diff --git a/syntribos/tests/__init__.py b/syntribos/tests/__init__.py index e69de29b..94d152e4 100644 --- a/syntribos/tests/__init__.py +++ b/syntribos/tests/__init__.py @@ -0,0 +1,16 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + diff --git a/syntribos/tests/base.py b/syntribos/tests/base.py index 6ea1c94b..365a2c05 100644 --- a/syntribos/tests/base.py +++ b/syntribos/tests/base.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from string import ascii_letters, digits from cafe.drivers.unittest.fixtures import BaseTestFixture diff --git a/syntribos/tests/fuzz/__init__.py b/syntribos/tests/fuzz/__init__.py index e69de29b..94d152e4 100644 --- a/syntribos/tests/fuzz/__init__.py +++ b/syntribos/tests/fuzz/__init__.py @@ -0,0 +1,16 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + diff --git a/syntribos/tests/fuzz/all_attacks.py b/syntribos/tests/fuzz/all_attacks.py index 4115e556..9f3075a9 100644 --- a/syntribos/tests/fuzz/all_attacks.py +++ b/syntribos/tests/fuzz/all_attacks.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from syntribos.tests.fuzz import base_fuzz diff --git a/syntribos/tests/fuzz/base_fuzz.py b/syntribos/tests/fuzz/base_fuzz.py index 46870a8a..65dd5bc2 100644 --- a/syntribos/tests/fuzz/base_fuzz.py +++ b/syntribos/tests/fuzz/base_fuzz.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + import os from syntribos.clients.http import SynHTTPClient, RequestCreator diff --git a/syntribos/tests/fuzz/config.py b/syntribos/tests/fuzz/config.py index b9ab8396..b38f21d6 100644 --- a/syntribos/tests/fuzz/config.py +++ b/syntribos/tests/fuzz/config.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from cafe.engine.models.data_interfaces import ConfigSectionInterface diff --git a/syntribos/tests/fuzz/datagen.py b/syntribos/tests/fuzz/datagen.py index c2efe944..d384afde 100644 --- a/syntribos/tests/fuzz/datagen.py +++ b/syntribos/tests/fuzz/datagen.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from xml.etree import ElementTree from syntribos.tests.fuzz.base_fuzz import BaseFuzzConfig diff --git a/syntribos/tests/fuzz/integer_overflow.py b/syntribos/tests/fuzz/integer_overflow.py index b53b8793..9da05af2 100644 --- a/syntribos/tests/fuzz/integer_overflow.py +++ b/syntribos/tests/fuzz/integer_overflow.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from syntribos.tests.fuzz import base_fuzz diff --git a/syntribos/tests/fuzz/ldap.py b/syntribos/tests/fuzz/ldap.py index 558751e6..bba9f799 100644 --- a/syntribos/tests/fuzz/ldap.py +++ b/syntribos/tests/fuzz/ldap.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from syntribos.tests.fuzz import base_fuzz diff --git a/syntribos/tests/fuzz/sql.py b/syntribos/tests/fuzz/sql.py index e378a4b9..56d707a9 100644 --- a/syntribos/tests/fuzz/sql.py +++ b/syntribos/tests/fuzz/sql.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + from syntribos.tests.fuzz import base_fuzz diff --git a/syntribos/tests/request_creator.py b/syntribos/tests/request_creator.py index 90aa5224..1b270dac 100644 --- a/syntribos/tests/request_creator.py +++ b/syntribos/tests/request_creator.py @@ -1,3 +1,19 @@ +""" +Copyright 2015 Rackspace + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + import re from copy import deepcopy from importlib import import_module