"Fossies" - the Fresh Open Source Software Archive

Member "keystone-17.0.0/keystone/federation/schema.py" (13 May 2020, 4103 Bytes) of package /linux/misc/openstack/keystone-17.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "schema.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 16.0.1_vs_17.0.0.

    1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    2 # not use this file except in compliance with the License. You may obtain
    3 # a copy of the License at
    4 #
    5 # http://www.apache.org/licenses/LICENSE-2.0
    6 #
    7 # Unless required by applicable law or agreed to in writing, software
    8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   10 # License for the specific language governing permissions and limitations
   11 # under the License.
   12 
   13 from keystone.common import validation
   14 from keystone.common.validation import parameter_types
   15 
   16 
   17 basic_property_id = {
   18     'type': 'object',
   19     'properties': {
   20         'id': {
   21             'type': 'string'
   22         }
   23     },
   24     'required': ['id'],
   25     'additionalProperties': False
   26 }
   27 
   28 saml_create = {
   29     'type': 'object',
   30     'properties': {
   31         'identity': {
   32             'type': 'object',
   33             'properties': {
   34                 'token': basic_property_id,
   35                 'methods': {
   36                     'type': 'array'
   37                 }
   38             },
   39             'required': ['token'],
   40             'additionalProperties': False
   41         },
   42         'scope': {
   43             'type': 'object',
   44             'properties': {
   45                 'service_provider': basic_property_id
   46             },
   47             'required': ['service_provider'],
   48             'additionalProperties': False
   49         },
   50     },
   51     'required': ['identity', 'scope'],
   52     'additionalProperties': False
   53 }
   54 
   55 _service_provider_properties = {
   56     # NOTE(rodrigods): The database accepts URLs with 256 as max length,
   57     # but parameter_types.url uses 225 as max length.
   58     'auth_url': parameter_types.url,
   59     'sp_url': parameter_types.url,
   60     'description': validation.nullable(parameter_types.description),
   61     'enabled': parameter_types.boolean,
   62     'relay_state_prefix': validation.nullable(parameter_types.description)
   63 }
   64 
   65 service_provider_create = {
   66     'type': 'object',
   67     'properties': _service_provider_properties,
   68     # NOTE(rodrigods): 'id' is not required since it is passed in the URL
   69     'required': ['auth_url', 'sp_url'],
   70     'additionalProperties': False
   71 }
   72 
   73 service_provider_update = {
   74     'type': 'object',
   75     'properties': _service_provider_properties,
   76     # Make sure at least one property is being updated
   77     'minProperties': 1,
   78     'additionalProperties': False
   79 }
   80 
   81 _identity_provider_properties_create = {
   82     'enabled': parameter_types.boolean,
   83     'description': validation.nullable(parameter_types.description),
   84     'domain_id': validation.nullable(parameter_types.id_string),
   85     'authorization_ttl': validation.nullable(parameter_types.integer_min0),
   86     'remote_ids': {
   87         'type': ['array', 'null'],
   88         'items': {
   89             'type': 'string'
   90         },
   91         'uniqueItems': True
   92     }
   93 }
   94 
   95 _identity_provider_properties_update = {
   96     'enabled': parameter_types.boolean,
   97     'description': validation.nullable(parameter_types.description),
   98     'authorization_ttl': validation.nullable(parameter_types.integer_min0),
   99     'remote_ids': {
  100         'type': ['array', 'null'],
  101         'items': {
  102             'type': 'string'
  103         },
  104         'uniqueItems': True
  105     }
  106 }
  107 
  108 identity_provider_create = {
  109     'type': 'object',
  110     'properties': _identity_provider_properties_create,
  111     'additionalProperties': False
  112 }
  113 
  114 identity_provider_update = {
  115     'type': 'object',
  116     'properties': _identity_provider_properties_update,
  117     # Make sure at least one property is being updated
  118     'minProperties': 1,
  119     'additionalProperties': False
  120 }
  121 
  122 _remote_id_attribute_properties = {
  123     'type': 'string',
  124     'maxLength': 64,
  125 }
  126 
  127 _protocol_properties = {
  128     'mapping_id': parameter_types.mapping_id_string,
  129     'remote_id_attribute': _remote_id_attribute_properties
  130 }
  131 
  132 protocol_create = {
  133     'type': 'object',
  134     'properties': _protocol_properties,
  135     'required': ['mapping_id'],
  136     'additionalProperties': False
  137 }
  138 
  139 protocol_update = {
  140     'type': 'object',
  141     'properties': _protocol_properties,
  142     'minProperties': 1,
  143     'additionalProperties': False
  144 }