+ raise ValueError('Hostname: %s is not a FQDN.' % args['hostname'])
+
+ if args['port'] and not args['port'].isdigit():
+ raise ValueError('Port number: %s is not an integer.' % args['port'])
+
+ # Validate that all path options begin with '/'
+ path_args = ['saml_base', 'saml_auth', 'saml_sp', 'saml_sp_logout',
+ 'saml_sp_post', 'saml_sp_paos']
+ for path_arg in path_args:
+ if args[path_arg] is not None and not args[path_arg].startswith('/'):
+ raise ValueError('--%s must begin with a / character.' %
+ path_arg.replace('_', '-'))
+
+ # The saml_sp setting must be a subpath of saml_base since it is
+ # used as the MellonEndpointPath.
+ if not args['saml_sp'].startswith(args['saml_base']):
+ raise ValueError('--saml-sp must be a subpath of --saml-base.')
+
+ # The saml_sp_logout, saml_sp_post and saml_sp_paos settings must
+ # be subpaths of saml_sp (the mellon endpoint).
+ path_args = {'saml_sp_logout': 'logout',
+ 'saml_sp_post': 'postResponse',
+ 'saml_sp_paos': 'paosResponse'}
+ for path_arg, default_path in path_args.items():
+ if args[path_arg] is None:
+ args[path_arg] = '%s/%s' % (args['saml_sp'].rstrip('/'),
+ default_path)
+
+ elif not args[path_arg].startswith(args['saml_sp']):
+ raise ValueError('--%s must be a subpath of --saml-sp' %
+ path_arg.replace('_', '-'))
+
+ # If saml_idp_url if being used, we require saml_sp_name to
+ # use when registering the SP.
+ if args['saml_idp_url'] and not args['saml_sp_name']:
+ raise ValueError('--saml-sp-name must be specified when using' +
+ '--saml-idp-url')