Loading devops-stages/stage-test.sh +1 −3 Original line number Diff line number Diff line Loading @@ -13,7 +13,5 @@ # See the License for the specific language governing permissions and # limitations under the License. set -e echo "Launching tox" tox --parallel=auto TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto osm_nbi/admin_topics.py +14 −39 Original line number Diff line number Diff line Loading @@ -345,7 +345,6 @@ class CommonVimWimSdn(BaseTopic): schema_version ) or self.config_to_encrypt.get("default") if edit_content.get("config") and config_to_encrypt_keys: for p in config_to_encrypt_keys: if edit_content["config"].get(p): final_content["config"][p] = self.db.encrypt( Loading Loading @@ -399,48 +398,25 @@ class CommonVimWimSdn(BaseTopic): if content.get("vim_type"): if content["vim_type"] == "openstack": compute = { "ram": { "total": None, "used": None }, "vcpus": { "total": None, "used": None }, "instances": { "total": None, "used": None } "ram": {"total": None, "used": None}, "vcpus": {"total": None, "used": None}, "instances": {"total": None, "used": None}, } storage = { "volumes": { "total": None, "used": None }, "snapshots": { "total": None, "used": None }, "storage": { "total": None, "used": None } "volumes": {"total": None, "used": None}, "snapshots": {"total": None, "used": None}, "storage": {"total": None, "used": None}, } network = { "networks": { "total": None, "used": None }, "subnets": { "total": None, "used": None }, "floating_ips": { "total": None, "used": None "networks": {"total": None, "used": None}, "subnets": {"total": None, "used": None}, "floating_ips": {"total": None, "used": None}, } content["resources"] = { "compute": compute, "storage": storage, "network": network, } content["resources"] = {"compute": compute, "storage": storage, "network": network} return "{}:0".format(content["_id"]) Loading Loading @@ -1097,7 +1073,6 @@ class UserTopicAuth(UserTopic): mapping["role"], mapping["role_name"], ): if mapping in mappings_to_remove: # do not remove mappings_to_remove.remove(mapping) break # do not add, it is already at user Loading osm_nbi/auth.py +8 −7 Original line number Diff line number Diff line Loading @@ -449,9 +449,11 @@ class Authenticator: elif auth_list[0].lower() == "basic": user_passwd64 = auth_list[-1] if not token: if cherrypy.session.get("Authorization"): if cherrypy.session.get("Authorization"): # pylint: disable=E1101 # 2. Try using session before request a new token. If not, basic authentication will generate token = cherrypy.session.get("Authorization") token = cherrypy.session.get( # pylint: disable=E1101 "Authorization" ) if token == "logout": token = None # force Unauthorized response to insert user password again elif user_passwd64 and cherrypy.request.config.get( Loading @@ -466,10 +468,10 @@ class Authenticator: except Exception: pass outdata = self.new_token( None, {"username": user, "password": passwd} None, {"username": user, "password": passwd}, None ) token = outdata["_id"] cherrypy.session["Authorization"] = token cherrypy.session["Authorization"] = token # pylint: disable=E1101 if not token: raise AuthException( Loading Loading @@ -508,8 +510,8 @@ class Authenticator: return token_info except AuthException as e: if not isinstance(e, AuthExceptionUnauthorized): if cherrypy.session.get("Authorization"): del cherrypy.session["Authorization"] if cherrypy.session.get("Authorization"): # pylint: disable=E1101 del cherrypy.session["Authorization"] # pylint: disable=E1101 cherrypy.response.headers[ "WWW-Authenticate" ] = 'Bearer realm="{}"'.format(e) Loading Loading @@ -775,7 +777,6 @@ class Authenticator: :param outdata: user token information """ user_content = None detail = {} present_time = time() user = outdata["username"] if self.config["authentication"].get("pwd_expiry_check"): Loading osm_nbi/authconn.py +1 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,7 @@ class Authconn: :param filter_q: dictionary to filter user list by name (username is also admited) and/or _id :return: returns a list of users. """ return list() # Default return value so that the method get_user passes pylint def get_user(self, _id, fail=True): """ Loading osm_nbi/authconn_internal.py +9 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,11 @@ __date__ = "$06-jun-2019 11:16:08$" import logging import re from osm_nbi.authconn import Authconn, AuthException, AuthconnConflictException # , AuthconnOperationException from osm_nbi.authconn import ( Authconn, AuthException, AuthconnConflictException, ) # , AuthconnOperationException from osm_common.dbbase import DbException from osm_nbi.base_topic import BaseTopic from osm_nbi.validation import is_valid_uuid Loading Loading @@ -380,11 +384,12 @@ class AuthconnInternal(Authconn): ) if old_pwd: salt = user_data["_admin"]["salt"] shadow_password = sha256(old_pwd.encode('utf-8') + salt.encode('utf-8')).hexdigest() shadow_password = sha256( old_pwd.encode("utf-8") + salt.encode("utf-8") ).hexdigest() if shadow_password != user_data["password"]: raise AuthconnConflictException( "Incorrect password", http_code=HTTPStatus.CONFLICT "Incorrect password", http_code=HTTPStatus.CONFLICT ) BaseTopic.format_on_edit(user_data, user_info) # User Name Loading Loading
devops-stages/stage-test.sh +1 −3 Original line number Diff line number Diff line Loading @@ -13,7 +13,5 @@ # See the License for the specific language governing permissions and # limitations under the License. set -e echo "Launching tox" tox --parallel=auto TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto
osm_nbi/admin_topics.py +14 −39 Original line number Diff line number Diff line Loading @@ -345,7 +345,6 @@ class CommonVimWimSdn(BaseTopic): schema_version ) or self.config_to_encrypt.get("default") if edit_content.get("config") and config_to_encrypt_keys: for p in config_to_encrypt_keys: if edit_content["config"].get(p): final_content["config"][p] = self.db.encrypt( Loading Loading @@ -399,48 +398,25 @@ class CommonVimWimSdn(BaseTopic): if content.get("vim_type"): if content["vim_type"] == "openstack": compute = { "ram": { "total": None, "used": None }, "vcpus": { "total": None, "used": None }, "instances": { "total": None, "used": None } "ram": {"total": None, "used": None}, "vcpus": {"total": None, "used": None}, "instances": {"total": None, "used": None}, } storage = { "volumes": { "total": None, "used": None }, "snapshots": { "total": None, "used": None }, "storage": { "total": None, "used": None } "volumes": {"total": None, "used": None}, "snapshots": {"total": None, "used": None}, "storage": {"total": None, "used": None}, } network = { "networks": { "total": None, "used": None }, "subnets": { "total": None, "used": None }, "floating_ips": { "total": None, "used": None "networks": {"total": None, "used": None}, "subnets": {"total": None, "used": None}, "floating_ips": {"total": None, "used": None}, } content["resources"] = { "compute": compute, "storage": storage, "network": network, } content["resources"] = {"compute": compute, "storage": storage, "network": network} return "{}:0".format(content["_id"]) Loading Loading @@ -1097,7 +1073,6 @@ class UserTopicAuth(UserTopic): mapping["role"], mapping["role_name"], ): if mapping in mappings_to_remove: # do not remove mappings_to_remove.remove(mapping) break # do not add, it is already at user Loading
osm_nbi/auth.py +8 −7 Original line number Diff line number Diff line Loading @@ -449,9 +449,11 @@ class Authenticator: elif auth_list[0].lower() == "basic": user_passwd64 = auth_list[-1] if not token: if cherrypy.session.get("Authorization"): if cherrypy.session.get("Authorization"): # pylint: disable=E1101 # 2. Try using session before request a new token. If not, basic authentication will generate token = cherrypy.session.get("Authorization") token = cherrypy.session.get( # pylint: disable=E1101 "Authorization" ) if token == "logout": token = None # force Unauthorized response to insert user password again elif user_passwd64 and cherrypy.request.config.get( Loading @@ -466,10 +468,10 @@ class Authenticator: except Exception: pass outdata = self.new_token( None, {"username": user, "password": passwd} None, {"username": user, "password": passwd}, None ) token = outdata["_id"] cherrypy.session["Authorization"] = token cherrypy.session["Authorization"] = token # pylint: disable=E1101 if not token: raise AuthException( Loading Loading @@ -508,8 +510,8 @@ class Authenticator: return token_info except AuthException as e: if not isinstance(e, AuthExceptionUnauthorized): if cherrypy.session.get("Authorization"): del cherrypy.session["Authorization"] if cherrypy.session.get("Authorization"): # pylint: disable=E1101 del cherrypy.session["Authorization"] # pylint: disable=E1101 cherrypy.response.headers[ "WWW-Authenticate" ] = 'Bearer realm="{}"'.format(e) Loading Loading @@ -775,7 +777,6 @@ class Authenticator: :param outdata: user token information """ user_content = None detail = {} present_time = time() user = outdata["username"] if self.config["authentication"].get("pwd_expiry_check"): Loading
osm_nbi/authconn.py +1 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,7 @@ class Authconn: :param filter_q: dictionary to filter user list by name (username is also admited) and/or _id :return: returns a list of users. """ return list() # Default return value so that the method get_user passes pylint def get_user(self, _id, fail=True): """ Loading
osm_nbi/authconn_internal.py +9 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,11 @@ __date__ = "$06-jun-2019 11:16:08$" import logging import re from osm_nbi.authconn import Authconn, AuthException, AuthconnConflictException # , AuthconnOperationException from osm_nbi.authconn import ( Authconn, AuthException, AuthconnConflictException, ) # , AuthconnOperationException from osm_common.dbbase import DbException from osm_nbi.base_topic import BaseTopic from osm_nbi.validation import is_valid_uuid Loading Loading @@ -380,11 +384,12 @@ class AuthconnInternal(Authconn): ) if old_pwd: salt = user_data["_admin"]["salt"] shadow_password = sha256(old_pwd.encode('utf-8') + salt.encode('utf-8')).hexdigest() shadow_password = sha256( old_pwd.encode("utf-8") + salt.encode("utf-8") ).hexdigest() if shadow_password != user_data["password"]: raise AuthconnConflictException( "Incorrect password", http_code=HTTPStatus.CONFLICT "Incorrect password", http_code=HTTPStatus.CONFLICT ) BaseTopic.format_on_edit(user_data, user_info) # User Name Loading