[精讚] [會員登入]
620

新增IDP程式使用google防機器人的驗證功能

身份認證程式新增google防機器人v2

分享此文連結 //n.sfs.tw/12733

分享連結 新增IDP程式使用google防機器人的驗證功能@外行中的外行
(文章歡迎轉載,務必尊重版權註明連結來源)
2019-05-23 11:19:59 最後編修
2018-09-20 11:56:41 By jung
 

一、申請呼叫google recaptcha api

https://www.google.com/recaptcha/intro/v3beta.html

google帳號登入後

選擇使用reCAPTCHA V2

 

將產生的key & secrets記錄下來

 

二、修改程式

先切到縣市IDP程式分支,右鍵選擇Git->Branch/Tag->Merge Revision

在Revision: 按下"Select"再選擇Remote要merge的分支

下方選擇"Always create commit這樣會產生一次commit紀錄方便理解

 

合併完成後,在LoginPage.java拿掉第74行註解

98行的註解拿掉

 

修改resource package下面的recaptcha.properties內容

將site.key & secret.key改成在google api申請到的值

以上

 

 

三、將mongo中記錄redirect uri的欄位從字串改為可儲存字串陣列值

進入mongo的xxstore資料庫

1. create snapshot & change field type form string to array

db.cncspstore.find().snapshot().forEach(function(e){db.cncspstore.update({_id:e._id},{$push:{
redirecturis:e.redirecturi}});});

2.remove original document field

db.cncspstore.update({},{$unset:{redirecturi:""}},false,true)

3.rename snapshot field

db.cncspstore.update({},{$rename:{'redirecturis':'redirecturi'}},false,true)

備註:

手動刪掉欄位中一筆資料值...

db.cncspstore.update({"clientid" : "要對應修改的clientid值"},{$set:{"redirecturi" : ["要修改的正確uri位址"]}})

 

在mongo中手動加入欄位資料

db.systemstore.update({"_id":ObjectId("5ae0b3c4f0382232e0xxxxd7")},{$push:{"manager":"neaoOOXX"}})

在mongo中刪除某個欄位內的某個數值

db.systemstore.update({"_id":ObjectId("5ae0bxxxf0382232e0e65dd7")},{$pull:{"manager":"neaxxx"}})

 

備份mongo

mongodump --db xxstore --out /root/mongobk/xxxx

還原mongo:必須指定備份路徑到bson檔位置,加上drop參數,先把collections都刪掉才能正確還原

mongorestore -d xxxstore --drop /home/ub/Documents/xxxx/xxxxstore/

在mongo裡有個表是用來放authcode雖然有時效,但mongo不會主動清除裡面的過期紀錄,可能導致系統效能問題

這時可用手動的方式檢查並刪除

db.authcodestore.count()

>42352

裡面存了4萬多筆紀錄沒有作用

可再用下列指令刪除

db.authcodestore.remove({})

重新檢查一次紀錄變成-1了

 

END

你可能感興趣的文章

更新程式取消google recaptcha改用輸入驗證碼 update cnclibs to 0.0.8.6

新增IDP程式使用google防機器人的驗證功能 身份認證程式新增google防機器人v2

更新程式環境到wildfly18+openjdk11-phase3: 伺服器環境升級準備 upgrade jdk and wildfly on server

縣市端IdP新增自訂首頁內容功能 合併本部主程式,手動於mongo內新增管理使用者資料

縣市IDP新增API功能 修改IDP程式增加API介面

在apache http server停用TLS 1.0/1.1 and SSL 2.0/3.0 How to disable outdated versions of SSL/TLS on Apache

我有話要說

>>

限制:留言最高字數1000字。 限制:未登入訪客,每則留言間隔需超過10分鐘,每日最多5則留言。

訪客留言

[無留言]

隨機好文

proxmox5.x using duplicati as cloud backup strategy install duplicati program on Proxmox host for remote backup using google drive account

被蘋果帳號釣魚網站詐騙的心得 請小心小額電信代收費詐騙

更新java版本後一定要做的事情 how to deal with PKIX path building failed issue after upgrade java sdk version in IDE

在ESXI6.7修改系統時間 how to modify esxi system time setting for good

how to add physical disks into HP smart array through esxi interface 如何在磁碟陣列卡上加入新的硬碟-未完待續