加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

正则表达式 – 具有区域设置的安全区域

发布时间:2020-12-14 02:29:25 所属栏目:百科 来源:网络整理
导读:如何使用区域设置保护操作 – 这在symfony1.4中非常简单.我现在使用symfony2.3: 我的security.yml: firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false login: pattern: frontend_account_login security: false secured_area:
如何使用区域设置保护操作 – 这在symfony1.4中非常简单.我现在使用symfony2.3:

我的security.yml:

firewalls:
    dev:
        pattern:  ^/(_(profiler|wdt)|css|images|js)/
        security: false

    login:
        pattern:  frontend_account_login
        security: false


    secured_area:
        pattern:    ^/
        anonymous: ~
        http_basic:
            realm: "Secured Demo Area"
        form_login:
            check_path: frontend_account_security_check
            login_path: frontend_account_login
            use_referer:        true
            default_target_path: frontend_account_hello
        logout:
            path:   /logout
            target: frontend_account_login            #anonymous: ~
        #http_basic:
        #    realm: "Secured Demo Area"

access_control:
    #This works:
    - { path: ^/de/account/secured/,roles: ROLE_ADMIN }
    - { path: ^/en/account/secured/,roles: ROLE_ADMIN } 
    #I want it kind of that way
    - { path: ^/{_locale}/account/secured/,roles: ROLE_ADMIN }

我用正则表达式阅读了一篇文章:^ / [a-z] / account / secured /.但它不起作用.知道如何使用语言环境保护区域.我在这里发现了一些帖子,但它们都不起作用.

谢谢!!!

如果您只有两个区域设置:
- { path: ^/(en|de)/account/secured/,roles: ROLE_ADMIN }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读