Skip to content

Feature/api auth refactor - #610

Open
tsubik wants to merge 6 commits into
developfrom
feature/api-auth-refactor
Open

Feature/api auth refactor#610
tsubik wants to merge 6 commits into
developfrom
feature/api-auth-refactor

Conversation

@tsubik

@tsubik tsubik commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Add cookie-based auth to API. Frontend apps are using the same domain, and Angular app is SPA and cookies are the most secure way of storing user authentication.

JIRA: https://gfw.atlassian.net/browse/OPEN-389

@tsubik
tsubik force-pushed the feature/api-auth-refactor branch 2 times, most recently from ebc89d2 to 2ad770b Compare June 10, 2026 11:54
@tsubik
tsubik marked this pull request as ready for review June 10, 2026 11:56
@tsubik
tsubik requested a review from santostiago June 10, 2026 11:56

@santostiago santostiago left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It all seems fine, but what is the goal?
What is the problem with the existing authorization header?

module ClassMethods
def apply_includes(records, directives)
super.includes(:document_file, :required_operator_document)
result = super

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This has nothing to do with the PR's goal, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, one of those methods was failing somewhere; that's why I added that safeguard everywhere.

@tsubik

tsubik commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@santostiago the goal is to eliminate high security issues and simplify things. I had an alternative: install doorkeeper or reimplement OAuth, as the current token system was not great (tokens not expiring, cannot be revoked, there should be short- and long-lived tokens, refresh tokens, the Angular app is an SPA - no server and it was keeping tokens in LocalStorage - bad practice). I decided that cookies as a standard for web-based applications are the safest and easiest choice. I'm currently using cookies for authorized download sessions, and with this I can remove download sessions and just keep this.

@tsubik
tsubik force-pushed the feature/api-auth-refactor branch from 2ad770b to 49cdb2e Compare July 29, 2026 10:46
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