如何为看门人的 skip_authorization 块指定超级应用程序列表?
How to specify the list of superapp(s) for doorkeeper's skip_authorization block?
我想auto-autorize some trusted apps为我们railsAPI和门卫
# Skip Authorization for trusted clients
Doorkeeper.configure
skip_authorization do |resource_owner, client|
client.superapp? || resource_owner.admin?
end
end
根据this comment,是app理解的概念。
这应该使用 client_id(s) 白名单来完成吗?
我如何指定超级应用列表?
提前致谢!
Superapp 是一个应该自定义实现的概念。
参考:https://github.com/doorkeeper-gem/doorkeeper/issues/488
自动授权受信任应用程序的最简单方法是使用受信任客户端的应用程序 ID,如下所示:
# config/initializers/doorkeeper.rb
skip_authorization do |resource_owner, client|
client.uid == "client application id goes here"
end
也许您也可以使用范围并将客户端的范围字段设置为 'trusted'(据我所知,直接转到数据库)。
但是,我相信,范围不应该以这种方式使用。他们通常会通知 resource_owner 客户端是什么类型,以便 he/she 可以选择授权或不授权。
参考:https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
我希望这有帮助!如果有人有更好的实现方法,那就太好了。
我认为最好创建一个迁移以在 oauth_applications
table 上添加一个 superapp
布尔字段。
那你可以
# Skip Authorization for trusted clients
Doorkeeper.configure
skip_authorization do |resource_owner, client|
client.superapp?
end
end
如果应用程序将 superapp 布尔值设置为 true
,则授权步骤将被跳过,它会自动授权应用程序而无需用户操作。
我想auto-autorize some trusted apps为我们railsAPI和门卫
# Skip Authorization for trusted clients
Doorkeeper.configure
skip_authorization do |resource_owner, client|
client.superapp? || resource_owner.admin?
end
end
根据this comment,是app理解的概念。
这应该使用 client_id(s) 白名单来完成吗? 我如何指定超级应用列表? 提前致谢!
Superapp 是一个应该自定义实现的概念。
参考:https://github.com/doorkeeper-gem/doorkeeper/issues/488
自动授权受信任应用程序的最简单方法是使用受信任客户端的应用程序 ID,如下所示:
# config/initializers/doorkeeper.rb
skip_authorization do |resource_owner, client|
client.uid == "client application id goes here"
end
也许您也可以使用范围并将客户端的范围字段设置为 'trusted'(据我所知,直接转到数据库)。
但是,我相信,范围不应该以这种方式使用。他们通常会通知 resource_owner 客户端是什么类型,以便 he/she 可以选择授权或不授权。
参考:https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
我希望这有帮助!如果有人有更好的实现方法,那就太好了。
我认为最好创建一个迁移以在 oauth_applications
table 上添加一个 superapp
布尔字段。
那你可以
# Skip Authorization for trusted clients
Doorkeeper.configure
skip_authorization do |resource_owner, client|
client.superapp?
end
end
如果应用程序将 superapp 布尔值设置为 true
,则授权步骤将被跳过,它会自动授权应用程序而无需用户操作。