在 Google Authenticator 应用中,您可以扫描二维码或手动输入颁发者提供的密钥。
在下面的屏幕截图中,您可以看到Google安全设置中2FA的设置,显示了如何按照第二种方法获取TOTP。
我的问题是:这个密钥是如何生成的?
我正在尝试为我的网站使用 Google Authenticator 支持 2FA,我发现了许多有关如何生成 QR 码的参考资料和文档,但没有提到替代方法。
编辑:
更清楚地说,我在 Grails 3 Web 应用程序中使用 Google Authenticator 支持 2FA。我已经通过为每个用户生成一个密钥(Base32
字符串)、提供一个二维码供用户扫描以及在登录时验证 TOTP 来实现整个用户流程。我用作依赖项:
org.jboss.aerogear:aerogear-otp-java
, aerogear OTP可根据 GA 的 TOTP 方便地验证用户密钥org.grails.plugins:qrcode
, qrcode Grails 插件生成二维码我的问题是关于在 Google Authenticator 应用程序中添加新条目的 2 种方法: 1. 扫描二维码(我这边一切正常) 2. 手动输入帐户名称和字母代码(在我的第一个屏幕截图中,代码是在 Google 安全设置中提供)
您可以看到 Android 版 GA 的说明性屏幕截图:
我如何生成并向fzee
用户提供这样的代码(从第一个屏幕截图开始,并在第二个屏幕截图中命名为“提供的密钥”)?我确信它是在 QR 码中编码的相同数据字符串的编码,但我不知道是哪个(不仅仅是Base32
)。
qr-code one-time-password google-authenticator two-factor-authentication totp
我的Mongo集合包含以下形式的文档:
{
...
"notifications": [
{
"enabled": true,
"groups": [ "NG1", "NG3" ]
},
{
"enabled": false,
"groups": []
}
]
}
Run Code Online (Sandbox Code Playgroud)
其中enabled
是布尔值,groups
是一个字符串列表.我需要执行的查询来确定有多少项notifications
有enabled = true
和包含给定的字符串groups
(如NG3
).
以前,没有enabled
后来作为要求引入的属性,我的查询很简单
db.collection.find({ "notifications.groups": "NG3" })
Run Code Online (Sandbox Code Playgroud)
我尝试了一些与$and
运营商的组合,但没有运气,所以任何建议都是受欢迎的.提前致谢!
我正在尝试一下contentEditable
并遇到这个问题:我有以下js片段
var range = document.getSelection().getRangeAt(0);
var newNode = document.createElement("span");
newNode.className = "customStyle";
range.surroundContents(newNode);
Run Code Online (Sandbox Code Playgroud)
这个HTML片段:
<ul>
<li>the <b>only entry</b> of the list</li>
</ul>
<p>Some text here in paragraph</p>
Run Code Online (Sandbox Code Playgroud)
js代码允许使用<span>
标记包装当前选择.
当选择包括整个HTML标签(例如,选择'唯一条目')时,它完美地工作,但当然,当选择仅包括其结尾之一时(例如,从'条目'选择'有些',两者都包括在内) .
虽然我知道这个问题并非无足轻重,但我正在寻找有关最佳方法的建议.提前致谢!
我正在将我的Grails 2.5.1网络应用程序升级到Grails 3.1.1.production
使用我使用的活动环境在本地运行应用程序
grails -Dgrails.env=production run-app
Run Code Online (Sandbox Code Playgroud)
现在我正在使用Gradle任务gradle bootRun
.
什么是最简单的等效于以前的语法?
我需要获取位于assets/schemas/resource.json
Grails 3服务中的静态资源的路径.
目前定义为
private final String SCHEMA = 'grails-app/assets/schemas/resource.json',
Run Code Online (Sandbox Code Playgroud)
这对development
环境很好,但当然不适合生产(因为它将位于<app_root>/assets/resource.json
.
我试图在我的案例中搜索如何利用资产管道,但到目前为止我真的不知道:P
提前致谢!
grails ×2
gradle ×1
gradle-task ×1
grails-3.0 ×1
grails-3.1 ×1
javascript ×1
mongodb ×1
qr-code ×1
range ×1
selection ×1
totp ×1