はじめに
Webシステム上で、固有の端末しかアクセスさせない方法はないか色々探してみると、「FingerPrint2」なるものがオープンソースで提供されており、試してみました。
「FingerPrint2」はCookieや端末IDに依存しないユーザー識別を行う技術として注目を浴びてるそうです。
使い方
使い方は非常に簡単です。「FingerPrint2」のサイトからjavascriptを入手しハッシュ値を取得するだけです。
1 2 3 4 5 6 7 8 9 10 11 12 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/2.1.5/fingerprint2.js"></script> <script> let options = {}; Fingerprint2.get(options, function (components) { const values = components.map(function (component) { return component.value }); const hash = Fingerprint2.x64hash128(values.join(''), 31); console.log(hash); TextFingerPrint.SetText(hash); }); </script> |
以下、表示イメージです。サーバー側でハッシュ値を管理しておけば、端末の管理ができそうです。