feat: support storing hashed client secrets#284
feat: support storing hashed client secrets#284strowk wants to merge 1 commit intogo-oauth2:masterfrom
Conversation
Adds a support to automatically hash client secrets before storing provided that the underlying store implements new SavingClientStore interface. Client store wrapper supporting hashing returns client info wrapped into structure that implements ClientPasswordVerifier using provided hashing algo for verifying. Hasher interface is added to allow any hashing algorythm to be used instead of default bcrypt.
|
TL;DR: Given all of the existing constraints described below, what you're expressing with your change is probably the best possible implementation given all of the existing constraints of the go-oauth2 library. There are a couple things I'd recommend:
Based on the interfaces defined for any client store, it looks like it's intended to be read-only from go-oauth2's perspective. However, expressing a consistent policy of hashing secrets - a very common requirement - is something I would expect to be able to do at the go-oauth2 level, regardless of store implementation. Looking at the structure expressed in model.go, it seems like the Unfortunately, the way that the library treats A better approach might be to really separate those concerns in the Another approach that is similar to what you're expressing is to proxy calls to a wrapped |
Adds a support to automatically hash client secrets before storing provided that the underlying store implements new SavingClientStore interface. Client store wrapper supporting hashing returns client info wrapped into structure that implements ClientPasswordVerifier using provided hashing algo for verifying. Hasher interface is added to allow any hashing algorythm to be used instead of default bcrypt.