shield
shield copied to clipboard
Dev: Add IP Restriction for Access Token and HMAC in Shield
Why?
If a token or HMAC key is leaked, it can only be used from specified IP addresses(Enhanced Security). Requests from unknown IPs will be rejected(Prevents Unauthorized Access). Many financial and payment services use this method(Industry Standard for Sensitive APIs).
Demo:
- Store
allowed_ipsin the extra field (as JSON) or add a dedicatedallowed_ipscolumn to auth_identities - Store allowed IPs when generating a token
- Validate IP when using a token
- Allow enabling/disabling this feature in Config/AuthToken.php
- Support for multi IPs
If you disagree or have suggestions for improvement, feel free to comment.
Dedicated column sounds reasonable.
I wouldn't limit this functionality to tokens only. This may be useful to any channel of authentication.