An identity management system written in go using
- ORM (Object Relational Mapping) - Gorm
- JWT (JSON Web Token)
- Gin (HTTP framework)
- GraphQL
Under development
- Resend confirmation email
- Add more tests
- Add documentation
- Add examples
Sebastian Erhardt
SMPT_USER=user_name
SMPT_PASSWORD=secure_password
SMPT_SERVER=email-smtp.eu-central-1.amazonaws.com
SMPT_PORT=465
SECURITY_JWT_AUDIENCE=APP
SECURITY_JWT_API_AUDIENCE=API
SECURITY_PEPPER={{SECURE_RANDOM_STRING}}
SECURITY_JWT_SECRET={{SECURE_RANDOM_STRING}}
SECURITY_JWT_ISSUER=YOUR_DOMAIN
s := identity.NewService("APP", mail.Address{
Name: "App",
Address: "no-reply@exameple.com",
}).
SetSQLClient(connections.SQLClient).
SetAuthConfirmationEndpoint("https://exameple.com/auth/confirm")
- Check if identity already exists
- Create new identity
- Create confirmation token link
- Send email / sms with confirmation link
Link endpoint
Auth Confirmation Endpoint + /registration/{{Random Token}}
e.g.
https://exameple.com/auth/confirm/registration/esrdzh534253qreafdsrgrqafeaar
- Activate account
If the activation is expired, the account will be deleted. The user will be able to register again.
- Check if identity already exists
- If identity exists already:
- Create reference to entity
- send info email
- If identity does not exist:
- Create invitation token
- Create reference to entity
- Send email with invitation link
- Register with password
- If identity exists already:
- Check if identity exists
- Checks if identity is active
- Checks if identity is blocked
- Checks if identity is cleared
- Generate token
- Save ip and agent
OWASP Forgot Password Checklist
The following short guidelines can be used as a quick reference to protect the forgot password service:
- Return a consistent message for both existent and non-existent accounts.
- Ensure that the time taken for the user response message is uniform.
- Use a side-channel to communicate the method to reset their password.
- Use URL tokens for the simplest and fastest implementation.
- Ensure that generated tokens or codes are:
- Randomly generated using a cryptographically safe algorithm.
- Sufficiently long to protect against brute-force attacks.
- Stored securely.
- Single use and expire after an appropriate period.
- Do not make a change to the account until a valid token is presented, such as locking out the account
- Generate Token
- Send Email with password change confirmation token link
- Reset password
- Generate Token
- Send Email with confirmation token link to old email
- Send Email with confirmation token link to new email
- Change email
- Send confirmation email
https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html
- Password Length
- Minimum length of the passwords should be enforced by the application. Passwords shorter than 8 characters are considered to be weak (NIST SP800-63B).
- Maximum password length should not be set too low, as it will prevent users from creating passphrases. A common maximum length is 64 characters due to limitations in certain hashing algorithms, as discussed in the Password Storage Cheat Sheet. It is important to set a maximum password length to prevent long password Denial of Service attacks.
- Users can generate API tokens with a longer lifetime
- Users can delete API tokens