imports:
    - { resource: template_config.yml }
    - { resource: life_style_tools_ciphering.yml }
    - { resource: life_style_dh_access_control.yml }
    - { resource: parameters.yml }
    - { resource: services.yml }

framework:
    #esi:             ~
    translator:      { fallback: "%locale%" }
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enabled: true, enable_annotations: true }
    templating:
        engines: ['twig']
        #assets_version: SomeVersionScheme
    default_locale:  "%locale%"
    trusted_hosts:   ~
    trusted_proxies: ~
    session:
        handler_id: session.handler.pdo
        cookie_lifetime:  86400
        # handler_id set to null will use default session handler from php.ini
        #handler_id:  ~
    fragments:       ~
    http_method_override: true

# session storage in db
parameters:
    pdo.db_options:
        db_table:    backend_session
        db_id_col:   session_id
        db_data_col: session_value
        db_time_col: session_time
        db_lifetime_col: session_lifetime
services:
    pdo:
        class: PDO
        arguments:
            dsn:      "%database_spsession_dsn%"
            user:     "%database_spsession_user%"
            password: "%database_spsession_password%"
        calls:
            - [setAttribute, [3, 2]] # \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION
    session.handler.pdo:
        class:     Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
        arguments: ["@pdo", "%pdo.db_options%"]

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    form:
        resources: ['bootstrap_3_layout.html.twig','LexikFormFilterBundle:Form:form_div_layout.html.twig']
    globals:
        webserviceversion: "1.2.0"
        webservicereadonly: "%database_webservice_readonly%"

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]
    filters:
        cssrewrite: ~

# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    spool:     { type: memory }

# Doctrine Configuration
doctrine:
    dbal:
        types:
            uuid: Ramsey\Uuid\Doctrine\UuidType
            uuid_binary: Ramsey\Uuid\Doctrine\UuidBinaryType
        default_connection: Backend
        connections:
            ReadWrite:
                driver:   "%database_readwrite_driver%"
                host:     "%database_readwrite_host%"
                port:     "%database_readwrite_port%"
                dbname:   "%database_readwrite_name%"
                user:     "%database_readwrite_user%"
                password: "%database_readwrite_password%"
                charset:  UTF8
            Backend:
                driver:   "%database_backend_driver%"
                host:     "%database_backend_host%"
                port:     "%database_backend_port%"
                dbname:   "%database_backend_name%"
                user:     "%database_backend_user%"
                password: "%database_backend_password%"
                charset:  UTF8
            ServiceProvider:
                driver:   "%database_sp_driver%"
                host:     "%database_sp_host%"
                port:     "%database_sp_port%"
                dbname:   "%database_sp_name%"
                user:     "%database_sp_user%"
                password: "%database_sp_password%"
                charset:  UTF8
            Webservice:
                driver:   "%database_webservice_driver%"
                host:     "%database_webservice_host%"
                port:     "%database_webservice_port%"
                dbname:   "%database_webservice_name%"
                user:     "%database_webservice_user%"
                password: "%database_webservice_password%"
                charset:  UTF8
    orm:
        default_entity_manager: Backend
        entity_managers:
            ReadWrite:
                connection: "%database_readwrite_connection%"
                mappings:
                    SsoBackendSessionBundle: ~
                    LifeStyleToolsDbLogBundle: ~
                    SsoAccessBundle: ~
                    LifeStyleToolsRestAuthBundle:
                        type: annotation
                        dir: Entity/Usage
                        prefix: LifeStyle\Tools\RestAuthBundle\Entity\Usage
                dql:
                    string_functions:
                        regexp: DoctrineExtensions\Query\Mysql\Regexp
            Backend:
                connection: Backend
                mappings:
                    SsoAccessBundle: ~
                    SsoBackendSecurityBundle: ~
                    FOSUserBundle: ~
                    LifeStyleSamlAuthBundle: ~
                    LifeStyleActivityLogBundle: ~
                    LifeStyleToolsRestAuthBundle:
                        type: annotation
                        dir: Entity/Configuration
                        prefix: LifeStyle\Tools\RestAuthBundle\Entity\Configuration
            ServiceProvider:
                connection: ServiceProvider
                mappings:
                    SsoWebserviceBundle:
                        type: yml
                        dir: Resources/config/doctrine/ServiceProvider
                        prefix: Sso\WebserviceBundle\Entity\ServiceProvider
            Webservice:
                connection: Webservice
                mappings:
                    AttributeGeneratorBundle: ~
                    SsoWebserviceBundle:
                        type: yml
                        dir: Resources/config/doctrine/Webservice
                        prefix: Sso\WebserviceBundle\Entity\Webservice
                dql:
                    string_functions:
                        regexp: DoctrineExtensions\Query\Mysql\Regexp

fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: Sso\BackendSecurityBundle\Entity\User
    from_email:
        address:        all@sso.com
        sender_name:    Sso Webservices

fos_rest:
    param_fetcher_listener: true
    body_listener: false
    format_listener:
        rules:
            - { path: ^/, priorities: [ html, json, xml ], fallback_format: ~, prefer_extension: true }
    body_converter:
        enabled: true
        validate: true
    view:
        view_response_listener: 'force'
        formats:
            xml:  true
            json: true
            html: true
        templating_formats:
            html: true
    exception:
        codes:
            'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
            'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
        messages:
            'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
    allowed_methods_listener: true
    access_denied_listener:
        json: false
    disable_csrf_role: ROLE_API

nelmio_api_doc:
    name: 'IDP REST API (1.1.0)'

life_style_tools_rest_auth:
    wsse_lifetime: "%rest_auth_wsse_lifetime%"  #x-wsse lifetime in seconds 300
    secured_against_replay_attack: "%rest_auth_secured_against_replay_attack%" #true or false

endroid_qr_code:
    size: 100
    padding: 10
    extension: gif
    error_correction_level: high
    foreground_color: { r: 0, g: 0, b: 0, a: 0 }
    background_color: { r: 255, g: 255, b: 255, a: 0 }
    label: false
    label_font_size: 16

# set default date format
jms_serializer:
    handlers:
        datetime:
            default_format: "Y-m-d\TH:i:sP"
            default_timezone: "UTC"

sso_webservice:
    feature_toggle:
        enable_application_access_control:
            enabled: "%enable_application_access_control%"
    password_history_size: "%password_history_size%"
    password_encrypt_default_type: "%password_encrypt_default_type%"
    security:
        user_access_application: '%application_user_access_control_application%'

sso_rest:
    blocking_enabled: true
    max_login_fails: 3
    clear_time_sec: 30

# configuration for SAML authentication integration
life_style_saml_auth:
    sp_name: ls-sso-idp
    idp_app_name: SsoUserWsAdmin

knp_paginator:
    page_range:                 5          # default page range used in pagination control
    default_options:
        page_name:              page       # page query parameter name
        sort_field_name:        sort       # sort field query parameter name
        sort_direction_name:    direction  # sort direction query parameter name
        distinct:               true       # ensure distinct results, useful when ORM queries are using GROUP BY statements
    template:
        pagination: KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig     # sliding pagination controls template
        sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig
