Skip to content

Commit

Permalink
feat: remove prn option\
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-engel committed Feb 14, 2021
1 parent 4cf20cc commit 238818d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 54 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- Remove the `prn` option as it's not included in the spec any longer #114

# 3.3.0

> 2020-12-24
Expand Down
78 changes: 39 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,6 @@ fn config_options<'a, 'b>() -> App<'a, 'b> {
.takes_value(true)
.long("aud")
.short("a")
.requires("principal"),
).arg(
Arg::with_name("principal")
.help("the principal of the token")
.takes_value(true)
.long("prn")
.short("p")
.requires("audience"),
).arg(
Arg::with_name("not_before")
.help("the time the JWT should become valid, in seconds or systemd.time string")
Expand Down Expand Up @@ -416,10 +408,8 @@ fn encode_token(matches: &ArgMatches) -> JWTResult<String> {
let issuer = PayloadItem::from_string_with_name(matches.value_of("issuer"), "iss");
let subject = PayloadItem::from_string_with_name(matches.value_of("subject"), "sub");
let audience = PayloadItem::from_string_with_name(matches.value_of("audience"), "aud");
let principal = PayloadItem::from_string_with_name(matches.value_of("principal"), "prn");
let mut maybe_payloads: Vec<Option<PayloadItem>> = vec![
issued_at, expires, issuer, subject, audience, principal, not_before,
];
let mut maybe_payloads: Vec<Option<PayloadItem>> =
vec![issued_at, expires, issuer, subject, audience, not_before];

maybe_payloads.append(&mut custom_payloads.unwrap_or_default());
maybe_payloads.append(&mut custom_payload.unwrap_or_default());
Expand Down
3 changes: 0 additions & 3 deletions tests/jwt-cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ mod tests {
"array=[1, 2, 3]",
"-P",
"object={\"foo\": \"bar\"}",
"-p",
"yolo-principal",
"-s",
"yolo-subject",
"{\"test\":\"json value\",\"bool\":true,\"json_number\":1}",
Expand All @@ -236,7 +234,6 @@ mod tests {
assert_eq!(header.kid, Some("1234".to_string()));
assert_eq!(claims.0["aud"], "yolo");
assert_eq!(claims.0["iss"], "yolo-service");
assert_eq!(claims.0["prn"], "yolo-principal");
assert_eq!(claims.0["sub"], "yolo-subject");
assert_eq!(claims.0["nbf"], nbf);
assert_eq!(claims.0["exp"], exp);
Expand Down

0 comments on commit 238818d

Please sign in to comment.