dept-eduk/cross-application-authenticator

该软件包最新版本(2.0.0)没有可用的许可证信息。

2.0.0 2019-10-31 09:59 UTC

This package is not auto-updated.

Last update: 2024-09-28 07:21:32 UTC


README

此插件允许您将用户会话从一个应用程序转移到另一个应用程序,例如,从一个应用程序打开一个网站并自动登录用户。

安装

  • composer require e3creative/cross-application-authenticator
  • php artisan vendor:publish

路由。

该软件包将添加两个路由到您的应用程序中。您可以在本包的配置中进行自定义,但默认情况下将如下所示

  • POST /api/v1/cross-application-authenticator 中间件:auth:api 必需的头部

      Accept: application/json
      Content-type: application/json
    

    必需数据

      url: the URL that the user should be authorised to be transferred to
    

    返回:新创建的令牌(对象)

  • GET /cross-application-authenticator [] 中间件:web 必需数据

      token: the token returned by the POST request
    

初始POST请求依赖于用户对请求的可用性,因此您应该像通常对请求进行用户认证一样对用户进行认证(例如,通过传递访问令牌)。

配置

发布供应商文件后,以下配置将可用

route_name

Description: theroute fragmant that will be used to create your endpoint
    routes
Default: 'cross-application-authenticator'

route_middleware_name

Description: the middleware that should be applied to your POST endpoint to
    ensure that only authorized users are able to retrieve a token
Default: 'auth:api'

route_prefix

Description: the route prefix for your POST endpoint
Default: 'api/v1'

failed_authentication_redirect

Description: the route name or URL that the GET endpoint should redirect to
    if the token supplied is missing or invalid
Default: 'login'

token_lifetime

Description: how long in SECONDS the transfer token should be valid for
    after generating it
Default: 60