Skip to content

Merge Dev/apikey into develop#6

Open
JCruiz15 wants to merge 9 commits into
developfrom
dev/APIkey
Open

Merge Dev/apikey into develop#6
JCruiz15 wants to merge 9 commits into
developfrom
dev/APIkey

Conversation

@JCruiz15
Copy link
Copy Markdown
Owner

Api token requirement feature added to GHOPI. Requesting availability to merge with develop

* Finished implementation of API key protocol.

* On every sensitive endpoint an API token will be requested before
doing anything.

* The API token is sended as a bearer token in 'Authentication' header.

* Instructions page updated, explaining API token procedure.

* README updated with API token environement variable.
@JCruiz15 JCruiz15 requested a review from jfaldanam September 14, 2023 13:41
@JCruiz15 JCruiz15 self-assigned this Sep 14, 2023
Comment thread main.go
http.HandleFunc(fmt.Sprintf("%s/api/refresh", subpath), refreshProxy)
http.HandleFunc(fmt.Sprintf("%s/api/reset/refresh", subpath), resetRefreshDate)
http.HandleFunc(fmt.Sprintf("%s/api/check-custom-fields", subpath), checkFields)
// http.HandleFunc(fmt.Sprintf("%s/api/save-APIkey", subpath), saveAPIkey)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this comment here?

Comment thread main.go
func getLogs(w http.ResponseWriter, r *http.Request) {
if !utils.APIkeyCheck(r) {
log.Warn("Error 401: API key token is not correct or was not found. Use your api key to use GHOPI's functionalities")
w.Write([]byte("ERROR 401"))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each time the error is returned it is worded differently

Comment thread oauths/oauthsGithub.go
Function LoginHandler creates the URL that redirects to GitHub with the permissions needed for GHOPI.
*/
func (gh *Github) LoginHandler(w http.ResponseWriter, r *http.Request) {
//TODO - CHECK APIKEY
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a todo or it is not a todo?

Function LoginHandler creates the URL that redirects to Open Project with the permissions needed for GHOPI.
*/
func (op *Openproject) LoginHandler(w http.ResponseWriter, r *http.Request) {
//TODO - CHECK APIKEY
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a todo or it is not a todo?

Comment thread templates/log.html
headers: {'Authentication': 'Bearer '.concat(readCookie("apikey"))}
});
let data = await response.text();
if(data == "ERROR 401") {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the check should be for response.status, and check the return value to see if ti valid or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants