auth

package
v0.0.0-...-556965f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2025 License: GPL-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package authenticate is build to authenticate the API.

Index

Constants

This section is empty.

Variables

View Source
var Jwks *jwk.Cache

Functions

func CreateOidcUser

func CreateOidcUser(c *gin.Context)

CreateOidcUser creates a new user via oidc id token

@Summary		Create new user via oidc id token
@Description	Create a new service user via oidc id token
@Id				CreateOidcUser
@Tags			Users
@Accept			json
@Produce		json
@Success		201	{object}	models.UserResponse
@Failure		400	{object}	models.LicenseError	"Invalid json body"
@Failure		409	{object}	models.LicenseError	"User already exists"
@Router			/users/oidc [post]

func CreateUser

func CreateUser(c *gin.Context)

CreateUser creates a new user

@Summary		Create new user
@Description	Create a new service user
@Id				CreateUser
@Tags			Users
@Accept			json
@Produce		json
@Param			user	body		models.UserCreate	true	"User to create"
@Success		201		{object}	models.UserResponse
@Failure		400		{object}	models.LicenseError	"Invalid json body"
@Failure		409		{object}	models.LicenseError	"User already exists"
@Security		ApiKeyAuth
@Router			/users [post]

func DeleteUser

func DeleteUser(c *gin.Context)

DeleteUser marks an existing user record as inactive

@Summary		Deactivate user
@Description	Deactivate an user
@Id				DeleteUser
@Tags			Users
@Accept			json
@Produce		json
@Param			username	path	string	true	"Username of the user to be marked as inactive"
@Success		204
@Failure		404	{object}	models.LicenseError	"No user with given username found"
@Security		ApiKeyAuth
@Router			/users/{username} [delete]

func GetAllUser

func GetAllUser(c *gin.Context)

GetAllUser retrieves a list of all users from the database.

@Summary		Get users
@Description	Get all service users
@Id				GetAllUsers
@Tags			Users
@Accept			json
@Produce		json
@Param			active	query		bool	false	"Active user only"
@Param			page	query		int		false	"Page number"
@Param			limit	query		int		false	"Number of records per page"
@Success		200		{object}	models.UserResponse
@Failure		404		{object}	models.LicenseError	"Users not found"
@Security		ApiKeyAuth
@Router			/users [get]

func GetUser

func GetUser(c *gin.Context)

GetUser retrieves a user by their user ID from the database.

@Summary		Get a user
@Description	Get a single user by username
@Id				GetUser
@Tags			Users
@Accept			json
@Produce		json
@Param			username	path		string	true	"Username"
@Success		200			{object}	models.UserResponse
@Failure		400			{object}	models.LicenseError	"Invalid user id"
@Failure		404			{object}	models.LicenseError	"User not found"
@Security		ApiKeyAuth
@Router			/users/{username} [get]

func Login

func Login(c *gin.Context)

Login user and get JWT tokens

@Summary		Login
@Description	Login to get JWT token
@Id				Login
@Tags			Users
@Accept			json
@Produce		json
@Param			user	body		models.UserLogin		true	"Login credentials"
@Success		200		{object}	object{token=string}	"JWT token"
@Failure		401		{object}	models.LicenseError		"Incorrect username or password"
@Router			/login [post]

func UpdateProfile

func UpdateProfile(c *gin.Context)

UpdateProfile updates one's user profile

@Summary		Users can update their profile using this endpoint
@Description	Users can update their profile using this endpoint
@Id				UpdateProfile
@Tags			Users
@Accept			json
@Produce		json
@Param			user	body		models.ProfileUpdate	true	"Profile fields to update"
@Success		200		{object}	models.UserResponse
@Failure		400		{object}	models.LicenseError	"Invalid json body"
@Security		ApiKeyAuth
@Router			/users [patch]

func UpdateUser

func UpdateUser(c *gin.Context)

UpdateUser updates a user, requires admin rights

@Summary		Update user, requires admin rights
@Description	Update a service user, requires admin rights
@Id				UpdateUser
@Tags			Users
@Accept			json
@Produce		json
@Param			username	path		string				true	"username of the user to be updated"
@Param			user		body		models.UserUpdate	true	"User to update"
@Success		200			{object}	models.UserResponse
@Failure		400			{object}	models.LicenseError	"Invalid json body"
@Failure		403			{object}	models.LicenseError	"This resource requires elevated access rights"
@Security		ApiKeyAuth
@Router			/users/{username} [patch]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL