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

Consider ability to force CK change #7

Closed
jessepeterson opened this issue Sep 30, 2022 · 1 comment · Fixed by #11
Closed

Consider ability to force CK change #7

jessepeterson opened this issue Sep 30, 2022 · 1 comment · Fixed by #11

Comments

@jessepeterson
Copy link
Member

The fix for #1 guarded against uploading tokens with a differing consumer key. However if the CK legitimately changes there may be a need to allow "forcing" replacing the OAuth tokens for a given DEP name.

@jessepeterson
Copy link
Member Author

Had to do this patch (to disable CK replacement check) to replace a token that had a different account replace the token:

diff --git a/cmd/depserver/main.go b/cmd/depserver/main.go
index 89824b7..ea01b2b 100644
--- a/cmd/depserver/main.go
+++ b/cmd/depserver/main.go
@@ -72,7 +72,7 @@ func main() {
        }
 
        tokensMux := dephttp.NewMethodMux()
-       tokensMux.Handle("PUT", api.StoreAuthTokensHandler(api.NewCKCheck(storage), logger.With("handler", "store-auth-tokens")))
+       tokensMux.Handle("PUT", api.StoreAuthTokensHandler(storage, logger.With("handler", "store-auth-tokens")))
        tokensMux.Handle("GET", api.RetrieveAuthTokensHandler(storage, logger.With("handler", "retrieve-auth-tokens")))
        handleStrippedAPI(tokensMux, endpointTokens)
 
@@ -83,7 +83,7 @@ func main() {
 
        tokenPKIMux := dephttp.NewMethodMux()
        tokenPKIMux.Handle("GET", api.GetCertTokenPKIHandler(storage, logger.With("handler", "get-token-pki")))
-       tokenPKIMux.Handle("PUT", api.DecryptTokenPKIHandler(storage, api.NewCKCheck(storage), logger.With("handler", "put-token-pki")))
+       tokenPKIMux.Handle("PUT", api.DecryptTokenPKIHandler(storage, storage, logger.With("handler", "put-token-pki")))
        handleStrippedAPI(tokenPKIMux, endpointTokenPKI)
 
        assignerMux := dephttp.NewMethodMux()

This issue was closed.
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 a pull request may close this issue.

1 participant