[精讚] [會員登入]
429

新增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

你可能感興趣的文章

新增縣市端回傳使用者資料功能 新增縣市端回傳使用者資料功能

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

更新IDP程式以新增及修正本地管理帳號登入 add locallogin page and function with local authorized account

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

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

[java]縣市IDP建置 使用NetBeans建置IDP程式

我有話要說

>>

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

訪客留言

[無留言]

隨機好文

bitbucket repository control application setup 安裝完bitbucket服務後,須設定bitbucket.properties

使用virtualbox每次都忘記的事情 share folder from win host to linux guest vm

在windows server建立radius服務使用active directory帳號驗證 setup windows server to add radius service using active directory accounts for authentication

IIS10設定url rewrite to https if you setup url rewrite function in IIS10, might cause api callback failed

在新版谷歌協作平台嵌入edimax或lass空氣盒子讀取數值並視覺化 embeeded javascript to read and visualized lass json value on new google site