小编ad3*_*ay0的帖子

laravel 5.3中的Web路由和api路由之间的差异

关于api路由的新概念,我阅读了很多帖子.我知道api路由用于移动平台,但它们之间存在代码级别差异

RouteServiceProvider我能看到

/**
     * Define the "web" routes for the application.
     *
     * These routes all receive session state, CSRF protection, etc.
     *
     * @return void
     */
    protected function mapWebRoutes()
    {
        Route::group([
            'middleware' => 'web',
            'namespace' => $this->namespace,
        ], function ($router) {
            require base_path('routes/web.php');
        });
    }

    /**
     * Define the "api" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapApiRoutes()
    {
        Route::group([
            'middleware' => 'api',
            'namespace' => $this->namespace, …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-5.3

1
推荐指数
1
解决办法
2197
查看次数

禁用包含路径变量的 url 的 spring 安全性

我正在工作的项目的 spring 安全antMatcher实现如下:

http.authorizeRequests()
    .antMatchers("/v1/users/**").authenticated()
    .antMatchers(HttpMethod.POST, "/v1/users/*/do").permitAll()
Run Code Online (Sandbox Code Playgroud)

当我尝试访问时,/v1/users/2/do我收到一个未经授权的错误,但我希望它可以访问,因为我在 URL 模式中添加了“permitAll()”。

我试过了:

.antMatchers(HttpMethod.POST, "/v1/users/{id}/do").permitAll()
Run Code Online (Sandbox Code Playgroud)

我仍然获得未经授权的访问。

java spring-security spring-boot

1
推荐指数
1
解决办法
258
查看次数

标签 统计

java ×1

laravel ×1

laravel-5.3 ×1

php ×1

spring-boot ×1

spring-security ×1