Consider ability to force CK change
jessepeterson opened this issue · 1 comments
jessepeterson commented
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 commented
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()