Categorygithub.com/dunv/uauth
modulepackage
1.0.74
Repository: https://github.com/dunv/uauth.git
Documentation: pkg.go.dev

# README

Build Status GoDoc codecov

uauth

A simple authentication implementation usable in connection with uhttp. It supports adding/modifying user, permisions and roles. Also additional user attributes can be specified which will then be added to the user model. I have only been using this with mongoDB so many parts could be quite specific.

# Packages

No description provided by the author

# Functions

No description provided by the author
Only for testing.
Resolves the userName from a request when using authBasic.
No description provided by the author
Auth verify JWT token in request header ("Authorization") This method assumes the BCryptSecret already attached to the request context i.e.
Auth verify JWT token in url ("jwt=...") This method assumes the BCryptSecret already attached to the request context i.e.
Resolves the userName from a request when using JWT.
Check that the user has the specified permissions.
No description provided by the author
No description provided by the author
No description provided by the author
CreateInitialRolesIfNotExist roles if non-existant.
CreateInitialUsersIfNotExist creates users if non-existant.
Only for testing.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GetUserFromRequest tries to get the userModel from a request using a token attribute from the get params.
GetUserFromRequestHeaders tries to get the userModel from a request using the "Authorization" header and "Bearer" scheme.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Only for testing.
Only for testing.
No description provided by the author
NewRoleService for creating a RoleService.
NewUserService for creating a UserService.
Parses a refreshToken into RefreshTokenModel.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Validates the following - parse token - verify signature - verify validity.
Validates the following - parse token - verify signature - verify validity - check if token is in Database and assigned to the user encoded in the token.

# Constants

CanCreateUsers Permission for creating users.
CanDeleteUsers Permission for deleting users.
CanReadUsers Permission for reading all users.
CanUpdateUsers Permission for updating users.
Context key which makes the authentication method accessible.
Context key which allows access to a readily parsed and evaluated user-object.
Context key for getting a ready userService.
Context key which allows access to the BCrypt secret (for generating and verifying JWT).
Context key which allows access to a mongoClient connected to the user db.
Context key which allows access to the name of the used userDB.
Context key for getting a ready userService.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
UserService datastructure.

# Type aliases

Permission type.