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

Refactor auth backend #406

Merged
merged 31 commits into from Mar 23, 2020
Merged

Refactor auth backend #406

merged 31 commits into from Mar 23, 2020

Conversation

g-k
Copy link
Contributor

@g-k g-k commented Nov 15, 2019

Refactoring for #96

  • Move the following autographer data structures:
signers       []signer.Signer
auths         map[string]authorization
signerIndex   map[string]int

to an in-memory implementation of a swappable authbackend interface that hides the signerIndex implementation details and update callers accordingly

  • remove makeSignerIndex from the autographer and index as auths are added
  • expose a getSignerForUser(userID, signerID string) (signer.Signer, error) method instead of getSignerID (which depends on access to the autographer signers and signerIndex)

r? @jvehent

@coveralls
Copy link

coveralls commented Nov 15, 2019

Pull Request Test Coverage Report for Build 4232

  • 130 of 139 (93.53%) changed or added relevant lines in 5 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.2%) to 74.129%

Changes Missing Coverage Covered Lines Changed/Added Lines %
main.go 19 20 95.0%
authorize.go 6 8 75.0%
memory_backend.go 89 95 93.68%
Files with Coverage Reduction New Missed Lines %
database/connect.go 3 70.83%
Totals Coverage Status
Change from base Build 4227: 0.2%
Covered Lines: 3470
Relevant Lines: 4681

💛 - Coveralls

@g-k g-k requested a review from jvehent November 15, 2019 22:32
@g-k g-k marked this pull request as ready for review November 15, 2019 22:33
@g-k g-k mentioned this pull request Nov 25, 2019
jvehent
jvehent previously approved these changes Feb 11, 2020
Copy link
Contributor

@jvehent jvehent left a comment

Choose a reason for hiding this comment

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

looks good. a few nits but nothing important.

errors.go Outdated Show resolved Hide resolved
authorize.go Show resolved Hide resolved
handlers.go Show resolved Hide resolved
memory_backend.go Show resolved Hide resolved
Copy link
Contributor

@jvehent jvehent left a comment

Choose a reason for hiding this comment

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

r+. The code looks much cleaner too, which is 👌

@jvehent jvehent merged commit 7b1af5a into master Mar 23, 2020
@g-k g-k deleted the refactor-auth-backend branch March 24, 2020 15:27
@g-k
Copy link
Contributor Author

g-k commented Feb 9, 2021

refs: #96

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.

None yet

3 participants