This commit is contained in:
Daniel Ponte 2022-11-13 09:05:52 -05:00
parent 3ab5b5b78a
commit 3981025fa4
2 changed files with 20 additions and 20 deletions

View file

@ -66,11 +66,11 @@ func (ss *SessionStore) verify(tr *TokenRequest, r *http.Request) (provider.Prov
}
type Credential struct {
ID CredID `json:"id"`
UserID UserID `json:"user_id"`
AuthProviderType string `json:"auth_provider_type"`
AuthProviderID *string `json:"auth_provider_id"`
DataRaw *json.RawMessage `json:"data,omitempty"`
ID CredID `json:"id"`
UserID UserID `json:"user_id"`
AuthProviderType string `json:"auth_provider_type"`
AuthProviderID *string `json:"auth_provider_id"`
DataRaw *json.RawMessage `json:"data,omitempty"`
user provider.ProviderUser `json:"-"`
}

View file

@ -19,7 +19,7 @@ var (
)
const (
SecretMode os.FileMode = 0600
SecretMode os.FileMode = 0600
DefaultMode os.FileMode = 0644
)
@ -27,10 +27,10 @@ type Data interface {
}
type item struct {
Version int `json:"version"`
MinorVersion *int `json:"minor_version,omitempty"`
Key string `json:"key"`
Data interface{} `json:"data"`
Version int `json:"version"`
MinorVersion *int `json:"minor_version,omitempty"`
Key string `json:"key"`
Data interface{} `json:"data"`
fmode os.FileMode
dirty bool
@ -44,11 +44,11 @@ type Item interface {
ItemKey() string
}
func (i *item) Dirty() { i.dirty = true }
func (i *item) IsDirty() bool { return i.dirty }
func (i *item) GetData() interface{} { return i.Data }
func (i *item) Dirty() { i.dirty = true }
func (i *item) IsDirty() bool { return i.dirty }
func (i *item) GetData() interface{} { return i.Data }
func (i *item) SetData(d interface{}) { i.Data = d; i.Dirty() }
func (i *item) ItemKey() string { return i.Key }
func (i *item) ItemKey() string { return i.Key }
func (it *item) mode() os.FileMode {
if it.fmode != 0 {
@ -61,7 +61,7 @@ func (it *item) mode() os.FileMode {
type fsStore struct {
fs.FS
storeRoot string
s map[string]*item
s map[string]*item
}
type Store interface {
@ -147,10 +147,10 @@ func (s *fsStore) Put(key string, version, minorVersion int, secretMode bool, da
}
it := &item{
Version: version,
Version: version,
MinorVersion: mv,
Key: key,
Data: data,
Key: key,
Data: data,
fmode: mode,
dirty: true,
@ -197,8 +197,8 @@ func OpenFileStore(configRoot string) (*fsStore, error) {
stor := os.DirFS(storeRoot)
return &fsStore{
FS: stor,
FS: stor,
storeRoot: storeRoot,
s: make(map[string]*item),
s: make(map[string]*item),
}, nil
}