Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial changes for personnal access token scopes #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ tokio-postgres = { version = "0.7", features = ["runtime", "with-serde_json-1",
#actix-web = { git = "https://github.com/ctron/actix-web", rev = "f3f41a0cc70e43564f8243b3ff425195566b5f16" } # FIXME: awaiting release 4.2.0
#actix-http = { git = "https://github.com/ctron/actix-web", rev = "f3f41a0cc70e43564f8243b3ff425195566b5f16" } # FIXME: awaiting release 4.2.0

drogue-client = { git = "https://github.com/drogue-iot/drogue-client", rev = "798c968f0a63a0debcff9965c66b361e85946458" } # FIXME: awaiting release 0.11.0
#drogue-client = { path = "../drogue-client" }
#drogue-client = { git = "https://github.com/drogue-iot/drogue-client", rev = "fdebb42a6cbaa872a779e892fefe0f687b34fa4b" } # FIXME: awaiting release 0.11.0
drogue-client = { path = "../drogue-client" }

[features]
default = ["default-tls", "actix", "openssl", "app", "postgres"]
Expand Down
1 change: 1 addition & 0 deletions src/auth/openid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl From<ExtendedClaims> for UserDetails {
Self {
user_id: claims.standard_claims.sub,
roles,
claims: None,
}
}
}
8 changes: 8 additions & 0 deletions src/auth/user.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Structures to work with users and identities.

use drogue_client::tokens::v1::AccessTokenClaims;
use drogue_client::user::v1::UserDetails;

/// Information about the authenticated user, may be anonymous
Expand All @@ -26,6 +27,13 @@ impl UserInformation {
Self::Anonymous => &EMPTY_ROLES,
}
}

pub fn token_claims(&self) -> Option<&AccessTokenClaims> {
match self {
Self::Authenticated(details) => details.claims.as_ref(),
Self::Anonymous => None,
}
}
}

/// Extractor for user information.
Expand Down