コード例 #1
0
ファイル: api.py プロジェクト: AlexeyDeyneko/st2
def _run_server():
    host = cfg.CONF.auth.host
    port = cfg.CONF.auth.port
    use_ssl = cfg.CONF.auth.use_ssl

    cert_file_path = os.path.realpath(cfg.CONF.auth.cert)
    key_file_path = os.path.realpath(cfg.CONF.auth.key)

    if use_ssl and not os.path.isfile(cert_file_path):
        raise ValueError('Certificate file "%s" doesn\'t exist' % (cert_file_path))

    if use_ssl and not os.path.isfile(key_file_path):
        raise ValueError('Private key file "%s" doesn\'t exist' % (key_file_path))

    socket = eventlet.listen((host, port))

    if use_ssl:
        socket = eventlet.wrap_ssl(socket,
                                   certfile=cert_file_path,
                                   keyfile=key_file_path,
                                   server_side=True)

    LOG.info('ST2 Auth API running in "%s" auth mode', cfg.CONF.auth.mode)
    LOG.info('(PID=%s) ST2 Auth API is serving on %s://%s:%s.', os.getpid(),
             'https' if use_ssl else 'http', host, port)

    wsgi.server(socket, app.setup_app())
    return 0
コード例 #2
0
def _run_server():
    host = cfg.CONF.auth.host
    port = cfg.CONF.auth.port
    use_ssl = cfg.CONF.auth.use_ssl

    cert_file_path = os.path.realpath(cfg.CONF.auth.cert)
    key_file_path = os.path.realpath(cfg.CONF.auth.key)

    if use_ssl and not os.path.isfile(cert_file_path):
        raise ValueError('Certificate file "%s" doesn\'t exist' %
                         (cert_file_path))

    if use_ssl and not os.path.isfile(key_file_path):
        raise ValueError('Private key file "%s" doesn\'t exist' %
                         (key_file_path))

    socket = eventlet.listen((host, port))

    if use_ssl:
        socket = eventlet.wrap_ssl(socket,
                                   certfile=cert_file_path,
                                   keyfile=key_file_path,
                                   server_side=True)

    LOG.info('ST2 Auth API running in "%s" auth mode', cfg.CONF.auth.mode)
    LOG.info('(PID=%s) ST2 Auth API is serving on %s://%s:%s.', os.getpid(),
             'https' if use_ssl else 'http', host, port)

    wsgi.server(socket, app.setup_app())
    return 0
コード例 #3
0
ファイル: api.py プロジェクト: nagyist/StackStorm-st2
def _run_server():
    host = cfg.CONF.auth.host
    port = cfg.CONF.auth.port

    LOG.info('(PID=%s) ST2 Auth API is serving on http://%s:%s.', os.getpid(), host, port)

    wsgi.server(eventlet.listen((host, port)), app.setup_app())
    return 0
コード例 #4
0
    def setUpClass(cls, **kwargs):
        super(BaseSAML2Controller, cls).setUpClass()

        config.parse_args()

        sso_backend_kwargs = {'metadata_url': MOCK_METADATA_URL, 'entity_id': MOCK_ENTITY_ID}
        kwargs_json = json.dumps(sso_backend_kwargs)
        cfg.CONF.set_override(name='sso', override=True, group='auth')
        cfg.CONF.set_override(name='sso_backend', override='saml2', group='auth')
        cfg.CONF.set_override(name='sso_backend_kwargs', override=kwargs_json, group='auth')

        with mock.patch('requests.get') as mock_requests_get:
            mock_requests_get.return_value = MockSamlMetadata()
            cls.app = TestApp(app.setup_app(), **kwargs)
コード例 #5
0
ファイル: wsgi.py プロジェクト: lyandut/st2
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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 st2auth import app

config = {
    'is_gunicorn': True,
    'config_args': ['--config-file', os.environ.get('ST2_CONFIG_PATH', '/etc/st2/st2.conf')]
}

application = app.setup_app(config)
コード例 #6
0
 def setUpClass(cls):
     super(FunctionalTest, cls).setUpClass()
     tests_config.parse_args()
     cls.app = TestApp(app.setup_app())
コード例 #7
0
ファイル: wsgi.py プロジェクト: zwunix/st2
# Copyright 2019 Extreme Networks, Inc.
#
# 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 st2auth import app

config = {
    'is_gunicorn':
    True,
    'config_args':
    ['--config-file',
     os.environ.get('ST2_CONFIG_PATH', '/etc/st2/st2.conf')]
}

application = app.setup_app(config)
コード例 #8
0
ファイル: base.py プロジェクト: StackStorm/st2
 def setUpClass(cls, **kwargs):
     super(FunctionalTest, cls).setUpClass()
     tests_config.parse_args()
     cls.app = TestApp(app.setup_app(), **kwargs)