Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add oauth2 codes and tokens to database#11779

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
code-asher wants to merge8 commits intomainfromasher/oauth2-exchange-db

Conversation

code-asher
Copy link
Member

@code-ashercode-asher commentedJan 23, 2024
edited
Loading

@code-ashercode-asher changed the titleAdd OAuth2 provider codes and tokens to databasefeat: add oauth2 codes and tokens to databaseJan 23, 2024
@code-ashercode-asher marked this pull request as ready for reviewJanuary 23, 2024 19:23
@code-asher
Copy link
MemberAuthor

@johnstcn just FYI I requested you along with@Emyrk since we co-wrote some of this and seems like it makes sense to get another pair of eyes.

Might have no match, and a -1 will panic.
Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

In the interest of avoiding later rework, would it be possible to add test coverage for the newly added methods in this PR?

Comment on lines +1250 to +1251
q.oauth2ProviderAppCodes[index] = q.oauth2ProviderAppCodes[len(q.oauth2ProviderAppCodes)-1]
q.oauth2ProviderAppCodes = q.oauth2ProviderAppCodes[:len(q.oauth2ProviderAppCodes)-1]
Copy link
Member

Choose a reason for hiding this comment

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

The thing about this is that it does change the slice order. If we care about order from a test assertion perspective, this will fail that assumption.

Testsshould be written such that if the order is required, they should specify in the query though, so we can leave this.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Good point! I think we will probably not have to worry about it since we do not rely on ordering of authentication codes (there is no method to get multiple codes right now either) but seems worth keeping in mind.

I lazily copied these lines from other implementations in this file but I think it might be better to add aremove and change all of these:

func remove[T any](slice []T, i int) []T {    return append(slice[:i], slice[i+1:]...)}

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The way I have been doing it (for apps and secrets which do need ordering) is to sort them before returning in theirGet* calls so the underlying slice can be in any order.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Ooo 1.21 has aDelete for slices apparently.

Emyrk reacted with eyes emoji
@code-asher
Copy link
MemberAuthor

code-asher commentedJan 24, 2024
edited
Loading

In the interest of avoiding later rework, would it be possible to add test coverage for the newly added methods in this PR?

Good question, do the dbauthz tests look insufficient? They test all the methods and that they return the right thing, I think (I might have the wrong impression on some of the things it does though.)

There are also the coderd tests added in the next PR (#11778) that end up hitting these methods, maybe I made the wrong call to split the PR here. I can hold off merging this until both are good to merge.

@johnstcn
Copy link
Member

johnstcn commentedJan 24, 2024
edited
Loading

Good question, do the dbauthz tests look insufficient?

Those just test authz assertions but don't necessarily call the actual SQL queries.

I can hold off merging this until both are good to merge.

That might not be a bad idea in case you need to make some changes here.

code-asher reacted with thumbs up emoji

@code-asher
Copy link
MemberAuthor

Those just test authz assertions but don't necessarily call the actual SQL queries.

Ohhhh I had the wrong impression, good to know.

@github-actionsgithub-actionsbot added the staleThis issue is like stale bread. labelFeb 1, 2024
@code-ashercode-asher mentioned this pull requestFeb 13, 2024
23 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@johnstcnjohnstcnjohnstcn left review comments

@EmyrkEmyrkEmyrk left review comments

Assignees

@code-ashercode-asher

Labels
staleThis issue is like stale bread.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@code-asher@johnstcn@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp