-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(oidc_auth): Add backend support for OIDC Auth
Signed-off-by: deo002 <[email protected]>
- Loading branch information
Showing
22 changed files
with
1,110 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# SPDX-FileCopyrightText: 2024 Kaushlendra Pratap <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
FROM golang:1.20 AS build | ||
FROM golang:1.21 AS build | ||
|
||
WORKDIR /LicenseDb | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -790,6 +790,12 @@ const docTemplate = `{ | |
} | ||
} | ||
} | ||
}, | ||
"409": { | ||
"description": "User registered only with OIDC authentication", | ||
"schema": { | ||
"$ref": "#/definitions/models.LicenseError" | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -1859,6 +1865,12 @@ const docTemplate = `{ | |
"summary": "Get users", | ||
"operationId": "GetAllUsers", | ||
"parameters": [ | ||
{ | ||
"type": "boolean", | ||
"description": "Active user only", | ||
"name": "active", | ||
"in": "query" | ||
}, | ||
{ | ||
"type": "integer", | ||
"description": "Page number", | ||
|
@@ -1912,7 +1924,7 @@ const docTemplate = `{ | |
"in": "body", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/models.UserInput" | ||
"$ref": "#/definitions/models.UserCreate" | ||
} | ||
} | ||
], | ||
|
@@ -1938,14 +1950,14 @@ const docTemplate = `{ | |
} | ||
} | ||
}, | ||
"/users/{id}": { | ||
"/users/{username}": { | ||
"get": { | ||
"security": [ | ||
{ | ||
"ApiKeyAuth": [] | ||
} | ||
], | ||
"description": "Get a single user by ID", | ||
"description": "Get a single user by username", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
|
@@ -1959,9 +1971,9 @@ const docTemplate = `{ | |
"operationId": "GetUser", | ||
"parameters": [ | ||
{ | ||
"type": "integer", | ||
"description": "User ID", | ||
"name": "id", | ||
"type": "string", | ||
"description": "Username", | ||
"name": "username", | ||
"in": "path", | ||
"required": true | ||
} | ||
|
@@ -1986,6 +1998,102 @@ const docTemplate = `{ | |
} | ||
} | ||
} | ||
}, | ||
"delete": { | ||
"security": [ | ||
{ | ||
"ApiKeyAuth": [] | ||
} | ||
], | ||
"description": "Deactivate an user", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"tags": [ | ||
"Users" | ||
], | ||
"summary": "Deactivate user", | ||
"operationId": "DeleteUser", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "Username of the user to be marked as inactive", | ||
"name": "username", | ||
"in": "path", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"204": { | ||
"description": "No Content" | ||
}, | ||
"404": { | ||
"description": "No user with given username found", | ||
"schema": { | ||
"$ref": "#/definitions/models.LicenseError" | ||
} | ||
} | ||
} | ||
}, | ||
"patch": { | ||
"security": [ | ||
{ | ||
"ApiKeyAuth": [] | ||
} | ||
], | ||
"description": "Update a service user", | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"tags": [ | ||
"Users" | ||
], | ||
"summary": "Update user", | ||
"operationId": "UpdateUser", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "username of the user to be updated", | ||
"name": "username", | ||
"in": "path", | ||
"required": true | ||
}, | ||
{ | ||
"description": "User to update", | ||
"name": "user", | ||
"in": "body", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/models.UserUpdate" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/models.UserResponse" | ||
} | ||
}, | ||
"400": { | ||
"description": "Invalid json body", | ||
"schema": { | ||
"$ref": "#/definitions/models.LicenseError" | ||
} | ||
}, | ||
"403": { | ||
"description": "This resource requires elevated access rights", | ||
"schema": { | ||
"$ref": "#/definitions/models.LicenseError" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
|
@@ -2829,40 +2937,35 @@ const docTemplate = `{ | |
}, | ||
"models.User": { | ||
"type": "object", | ||
"required": [ | ||
"userlevel", | ||
"username" | ||
], | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"example": 123 | ||
}, | ||
"userlevel": { | ||
"user_email": { | ||
"type": "string", | ||
"example": "[email protected]" | ||
}, | ||
"user_level": { | ||
"type": "string", | ||
"example": "admin" | ||
"example": "USER" | ||
}, | ||
"username": { | ||
"type": "string", | ||
"example": "fossy" | ||
} | ||
} | ||
}, | ||
"models.UserInput": { | ||
"models.UserCreate": { | ||
"type": "object", | ||
"required": [ | ||
"password", | ||
"userlevel", | ||
"user_email", | ||
"username" | ||
], | ||
"properties": { | ||
"password": { | ||
"user_email": { | ||
"type": "string", | ||
"example": "fossy" | ||
}, | ||
"userlevel": { | ||
"type": "string", | ||
"example": "admin" | ||
"example": "[email protected]" | ||
}, | ||
"username": { | ||
"type": "string", | ||
|
@@ -2904,6 +3007,29 @@ const docTemplate = `{ | |
"example": 200 | ||
} | ||
} | ||
}, | ||
"models.UserUpdate": { | ||
"type": "object", | ||
"properties": { | ||
"active": { | ||
"type": "boolean" | ||
}, | ||
"user_level": { | ||
"type": "string", | ||
"enum": [ | ||
"USER", | ||
"ADMIN" | ||
], | ||
"example": "ADMIN" | ||
}, | ||
"user_password": { | ||
"type": "string" | ||
}, | ||
"username": { | ||
"type": "string", | ||
"example": "fossy" | ||
} | ||
} | ||
} | ||
}, | ||
"securityDefinitions": { | ||
|
Oops, something went wrong.