Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store user session in browser #219

Merged
merged 1 commit into from
Oct 4, 2022
Merged

Store user session in browser #219

merged 1 commit into from
Oct 4, 2022

Conversation

feedmeapples
Copy link
Contributor

@feedmeapples feedmeapples commented Sep 14, 2022

What was changed

Moved user session to be stored client side

Why?

resolve #216

Allows to scale UI horizontally by making ui-server stateless

Checklist

  1. Closes

  2. How was this tested:

E2E: Verified that a user can login
Manual: Verified login and logout flows. Verified that API requests contain authorization and authorization-extras headers. Verified that codec requests contain authorization header

  1. Any docs updates needed?

@feedmeapples feedmeapples marked this pull request as draft September 14, 2022 07:20
@feedmeapples feedmeapples force-pushed the auth branch 3 times, most recently from 5a5adf8 to 5a9eac5 Compare September 19, 2022 03:12
@feedmeapples feedmeapples marked this pull request as ready for review September 19, 2022 03:51
@feedmeapples feedmeapples force-pushed the auth branch 3 times, most recently from cf19227 to 230d5b4 Compare September 19, 2022 03:59
} else {
fmt.Println("Using cookie session store")
}

Choose a reason for hiding this comment

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

👌

metaT := "<meta name=\"%s\" content=\"%s\" />"
assert.Contains(t, string(html), fmt.Sprintf(metaT, "return-url", "http://localhost:8080/namespaces/default"))
assert.Contains(t, string(html), fmt.Sprintf(metaT, "public-path", "/custom-path"))
}

Choose a reason for hiding this comment

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

Yay Tests!

<meta name="return-url" content="{{.ReturnUrl}}" />
<meta name="public-path" content="{{.PublicPath}}" />
</head>
</html>

Choose a reason for hiding this comment

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

Just thinking out loud headers may be a good way to send this data back in the callback instead of the meta of the html document.

Copy link
Contributor Author

@feedmeapples feedmeapples Sep 24, 2022

Choose a reason for hiding this comment

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

i want to revisit this particular piece (sending access-token to client) because when returning an html we are limitied to only the current domain and can't serve as a true API only server when it comes to auth endpoint

So instead of sending html at all, get back setting cookie items with users data, except for also breaking down the user object into 4kb cookie items to not exceed the size limit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done ^

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.

[Proposal] Store user session in Browser only
3 participants