コード例 #1
0
    def test_user_scim2keystone(self):
        scim = {
            'schemas': ['urn:scim:schemas:core:1.0',
                        'urn:scim:schemas:extension:keystone:1.0'],
            'id': '19041ee7679649879ada04417753ad4d',
            'userName': '******',
            'displayName': 'Alice Smith',
            'emails': [
                {
                    'value': '*****@*****.**'
                }
            ],
            'password': '******',
            'active': True,
            'urn:scim:schemas:extension:keystone:1.0': {
                'domain_id': '91d79dc2211d43a7985ebc27cdd146df'
            }
        }

        keystone = {
            'id': '19041ee7679649879ada04417753ad4d',
            'domain_id': '91d79dc2211d43a7985ebc27cdd146df',
            'email': '*****@*****.**',
            'name': 'alice',
            'description': 'Alice Smith',
            'password': '******',
            'enabled': True
        }

        self.assertEqual(keystone, conv.user_scim2key(scim))
コード例 #2
0
    def test_user_scim2keystone(self):
        scim = {
            'schemas': [
                'urn:scim:schemas:core:1.0',
                'urn:scim:schemas:extension:keystone:1.0'
            ],
            'id':
            '19041ee7679649879ada04417753ad4d',
            'userName':
            '******',
            'displayName':
            'Alice Smith',
            'emails': [{
                'value': '*****@*****.**'
            }],
            'password':
            '******',
            'active':
            True,
            'urn:scim:schemas:extension:keystone:1.0': {
                'domain_id': '91d79dc2211d43a7985ebc27cdd146df'
            }
        }

        keystone = {
            'id': '19041ee7679649879ada04417753ad4d',
            'domain_id': '91d79dc2211d43a7985ebc27cdd146df',
            'email': '*****@*****.**',
            'name': 'alice',
            'description': 'Alice Smith',
            'password': '******',
            'enabled': True
        }

        self.assertEqual(keystone, conv.user_scim2key(scim))
コード例 #3
0
    def patch_user(self, context, user_id, **kwargs):
        scim = self._denormalize(kwargs)
        user = conv.user_scim2key(scim)
        if CONF.spassword.enabled and 'password' in user:
            super(SPasswordScimUserV3Controller, self).strong_check_password(
                user['password'])

        # TODO: update_user_modification_time()
        return super(SPasswordScimUserV3Controller, self).patch_user(context,
                                                                     user_id,
                                                                     **kwargs)
コード例 #4
0
    def patch_user(self, context, user_id, **kwargs):
        scim = self._denormalize(kwargs)
        user = conv.user_scim2key(scim)
        if CONF.spassword.enabled and 'password' in user:
            super(SPasswordScimUserV3Controller, self).strong_check_password(
                user['password'])

        # TODO: update_user_modification_time()
        return super(SPasswordScimUserV3Controller, self).patch_user(context,
                                                                     user_id,
                                                                     **kwargs)
コード例 #5
0
    def test_user_scim2keystone_no_mandatory_fields(self):
        scim = {
            'schemas': ['urn:scim:schemas:core:1.0',
                        'urn:scim:schemas:extension:keystone:1.0'],
            'userName': '******',
            'urn:scim:schemas:extension:keystone:1.0': {
                'domain_id': '91d79dc2211d43a7985ebc27cdd146df'
            }
        }

        keystone = {
            'domain_id': '91d79dc2211d43a7985ebc27cdd146df',
            'name': 'alice',
        }

        self.assertEqual(keystone, conv.user_scim2key(scim))
コード例 #6
0
 def patch(self, user_id):
     user_data = self.request_body_json
     user_data = self._normalize_dict(user_data)
     scim = self._denormalize(user_data)
     user = conv.user_scim2key(scim)
     if CONF.spassword.enabled and 'password' in user:
         try:
             super(SPasswordScimUserResource,
                   self).strong_check_password(user['password'])
         except Exception as e:
             msg = '%s' % e
             resp = flask.make_response(msg, http_client.BAD_REQUEST)
             resp.headers['Content-Type'] = 'application/json'
             return resp
     # TODO: update_user_modification_time()
     return super(SPasswordScimUserResource, self).patch(user_id)
コード例 #7
0
    def test_user_scim2keystone_no_mandatory_fields(self):
        scim = {
            'schemas': [
                'urn:scim:schemas:core:1.0',
                'urn:scim:schemas:extension:keystone:1.0'
            ],
            'userName':
            '******',
            'urn:scim:schemas:extension:keystone:1.0': {
                'domain_id': '91d79dc2211d43a7985ebc27cdd146df'
            }
        }

        keystone = {
            'domain_id': '91d79dc2211d43a7985ebc27cdd146df',
            'name': 'alice',
        }

        self.assertEqual(keystone, conv.user_scim2key(scim))