Content-Length: 284162 | pFad | https://github.com/sebadob/rauthy/commit/c9073cb473be04092e326c95ca7a1b3502379f40

47 Merge pull request #92 from sebadob/impl-alg-in-pub-jwks · sebadob/rauthy@c9073cb · GitHub
Skip to content

Commit

Permalink
Merge pull request #92 from sebadob/impl-alg-in-pub-jwks
Browse files Browse the repository at this point in the history
impl alg in pub JWKS
  • Loading branch information
sebadob authored Oct 24, 2023
2 parents b57656f + 740f101 commit c9073cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rauthy-models/src/entity/jwk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub struct JWKS {

// CRUD
impl JWKS {
pub async fn find_pk(data: &web::Data<AppState>) -> Result<Self, ErrorResponse> {
pub async fn find_pk(data: &web::Data<AppState>) -> Result<JWKS, ErrorResponse> {
if let Some(jwks) = cache_get!(
JWKS,
CACHE_NAME_12HR.to_string(),
Expand Down Expand Up @@ -198,7 +198,8 @@ impl JWKS {

#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct JWKSPublicKey {
pub kty: String, // RSA | OKP
pub kty: String, // RSA | OKP
pub alg: String,
pub crv: Option<String>, // Ed25519
pub kid: String,
pub n: Option<String>, // RSA
Expand All @@ -210,6 +211,7 @@ impl JWKSPublicKey {
pub fn from_key_pair(key_pair: &JwkKeyPair) -> Self {
let get_rsa = |kid: String, comp: algorithms::RSAPublicKeyComponents| JWKSPublicKey {
kty: "RSA".to_string(),
alg: key_pair.typ.to_string(),
crv: None,
kid,
n: Some(base64_url_encode(&comp.n)),
Expand All @@ -219,6 +221,7 @@ impl JWKSPublicKey {

let get_ed25519 = |kid: String, x: String| JWKSPublicKey {
kty: "OKP".to_string(),
alg: key_pair.typ.to_string(),
crv: Some("Ed25519".to_string()),
kid,
n: None,
Expand Down
2 changes: 2 additions & 0 deletions rauthy-models/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl From<JWKS> for JWKSCerts {
#[derive(Debug, Serialize, ToSchema)]
pub struct JWKSPublicKeyCerts {
pub kty: String, // RSA | OCT
pub alg: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub crv: Option<String>, // Ed25519
pub kid: String,
Expand All @@ -129,6 +130,7 @@ impl From<JWKSPublicKey> for JWKSPublicKeyCerts {
fn from(pk: JWKSPublicKey) -> Self {
Self {
kty: pk.kty,
alg: pk.alg,
crv: pk.crv,
kid: pk.kid,
n: pk.n,
Expand Down

0 comments on commit c9073cb

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/sebadob/rauthy/commit/c9073cb473be04092e326c95ca7a1b3502379f40

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy