【问题标题】:JWTAuthenticator and how it modifies the value of the routesJWTAuthenticator 以及它如何修改路由的值
【发布时间】:2016-03-11 09:45:20
【问题描述】:

我正在使用 Silhouette 的 JWTAuthenticator 使用令牌实现身份验证器。为了简单起见,我决定改编 Silhouette Slick Seed Template,这是一个非常好的入门示例。对代码进行一些细微的更改(我遵循了 Silhouette Angular Seed Template)我在以下代码行之后遇到了问题

 env.authenticatorService.init(authenticator).flatMap { v =>

... 似乎这个实现的方法“init”负责改变一些值 val 结果 = 重定向(routes.ApplicationController.index()) 到正确的路线,例如 “GET /”在这种情况下。 当我运行 JWTAuthenticator 版本时,我得到了值 结果(303,地图(位置-> /))代替! (对于索引中定义的路由)

在身份验证定义 (CredentialsAuthController.scala) 中的代码玩一点,你会在 init 方法之前的任何地方得到这种 Result(303, Map(Location -> /)) ......所以它就像这样“init " 功能允许您获得正确的重定向路线。那是对的吗?。 因此,基于这些结果,我的问题是: 为什么应用这个初始化函数后没有给我正确的路线?

如果您对此问题感兴趣,请查看 jwtimpl 分支

https://github.com/renexdev/Silhouette-Slick-Seed-pg-jwt

感谢您的宝贵时间, ReneX

【问题讨论】:

    标签: playframework playframework-2.0 silhouette


    【解决方案1】:

    到目前为止,它就像 JWTAutheticator 并没有持久化身份验证器。请参阅https://groups.google.com/forum/#!topic/play-silhouette/hKg0ThjUEAI 的完整讨论。我将转向 Silhouette Angular Seed Template 来使用 JWTAuthenticator。谢谢阿基!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-28
      • 1970-01-01
      • 2012-12-22
      • 2015-09-25
      • 1970-01-01
      • 1970-01-01
      • 2011-07-05
      • 1970-01-01
      相关资源
      最近更新 更多