Add resource-scoped bearer access metadata
This commit is contained in:
parent
a05112e6a2
commit
d072843cac
10 changed files with 344 additions and 11 deletions
|
|
@ -582,6 +582,23 @@ impl Store {
|
|||
.map_err(StoreError::from)
|
||||
}
|
||||
|
||||
pub fn list_auth_ops(&self) -> Result<Vec<StoredAuthOp>, StoreError> {
|
||||
let mut stmt = self.conn.prepare(
|
||||
r#"SELECT op_id, resource_id, op_json, created_at_ms
|
||||
FROM auth_ops ORDER BY resource_id, created_at_ms, op_id"#,
|
||||
)?;
|
||||
let rows = stmt.query_map([], |row| {
|
||||
Ok(StoredAuthOp {
|
||||
op_id: row.get(0)?,
|
||||
resource_id: row.get(1)?,
|
||||
op_json: row.get(2)?,
|
||||
created_at_ms: row.get(3)?,
|
||||
})
|
||||
})?;
|
||||
rows.collect::<Result<Vec<_>, _>>()
|
||||
.map_err(StoreError::from)
|
||||
}
|
||||
|
||||
pub fn insert_keychain_op(&self, op: &StoredKeychainOp) -> Result<(), StoreError> {
|
||||
self.conn.execute(
|
||||
r#"INSERT OR REPLACE INTO keychain_ops(op_id, op_json, created_at_ms)
|
||||
|
|
@ -995,6 +1012,7 @@ mod tests {
|
|||
.expect("list auth ops"),
|
||||
vec![first]
|
||||
);
|
||||
assert_eq!(store.list_auth_ops().expect("list all auth ops").len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue