add scopes to verify endpoint

This commit is contained in:
Bevan Hunt 2021-04-30 17:57:04 -07:00
parent c868cab517
commit 791c1b6d6b
4 changed files with 9 additions and 4 deletions

View File

@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [15.1.0] - 2021-04-30
### Added
- scopes to verify endpoint
## [15.0.0] - 2021-04-16
### Added

2
Cargo.lock generated
View File

@ -543,7 +543,7 @@ dependencies = [
[[package]]
name = "broker"
version = "15.0.0"
version = "15.1.0"
dependencies = [
"anyhow",
"async-std",

View File

@ -1,6 +1,6 @@
[package]
name = "broker"
version = "15.0.0"
version = "15.1.0"
authors = ["Bevan Hunt <bevan@bevanhunt.com>"]
edition = "2018"
license = "MIT"

View File

@ -318,7 +318,7 @@ fn jwt_aud(scopes: Vec<String>, exp: i64, username: String) -> Result<Option<Str
let mut builder = Biscuit::builder(&biscuit_root);
for scope in scopes {
for scope in scopes.clone() {
let mut parts = scope.split(":");
let first = parts.next().unwrap_or_else(|| "INTERNAL_ERROR");
let second = parts.next().unwrap_or_else(|| "INTERNAL_ERROR");
@ -331,7 +331,7 @@ fn jwt_aud(scopes: Vec<String>, exp: i64, username: String) -> Result<Option<Str
}
let biscuit = builder.build()?;
Ok(Some(json!({"key": public_key_bytes, "token": biscuit.to_vec()?, "expiry": exp, "username": username}).to_string()))
Ok(Some(json!({"key": public_key_bytes, "token": biscuit.to_vec()?, "expiry": exp, "username": username, "scopes": scopes}).to_string()))
}
fn user_create(user_form: UserForm) -> Result<Option<String>> {