mbos2 / url-shortener

Simple, Selfhosted, URLShortener service
MIT License
8 stars 3 forks source link

Authenthication #5

Open mbos2 opened 11 months ago

mbos2 commented 11 months ago

Is your feature request related to a problem? Please describe. Authenthication to secure your private short-url service

Describe the solution you'd like Authenthication to secure your private url shortener service.

To keep it simple, but secure, create env variables in your function environment: AUTH_USERNAME AUTH_PASSWORD

Username should be at least 8 characters long. Password should be at least 8 characters long. Password should be hashed with argon2 encryption, and then stored in env variable. Password should be validated with argon2 when trying to sign in.

Input validations should happen both on client side and server side.

Make sure that if AUTH_USERNAME or AUTH_PASSWORD environment variables are set to display sign in page where you will enter your credentials before you can access your url shortener service.

Implement JWT access token with expiration time of 4 hours.

Behaviour logic

GET