Skip to content

Commit 238818d

Browse files
committed
feat: remove prn option\
closes #114
1 parent 4cf20cc commit 238818d

File tree

4 files changed

+43
-54
lines changed

4 files changed

+43
-54
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- Remove the `prn` option as it's not included in the spec any longer #114
4+
35
# 3.3.0
46

57
> 2020-12-24

Cargo.lock

+39-39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,6 @@ fn config_options<'a, 'b>() -> App<'a, 'b> {
204204
.takes_value(true)
205205
.long("aud")
206206
.short("a")
207-
.requires("principal"),
208-
).arg(
209-
Arg::with_name("principal")
210-
.help("the principal of the token")
211-
.takes_value(true)
212-
.long("prn")
213-
.short("p")
214-
.requires("audience"),
215207
).arg(
216208
Arg::with_name("not_before")
217209
.help("the time the JWT should become valid, in seconds or systemd.time string")
@@ -416,10 +408,8 @@ fn encode_token(matches: &ArgMatches) -> JWTResult<String> {
416408
let issuer = PayloadItem::from_string_with_name(matches.value_of("issuer"), "iss");
417409
let subject = PayloadItem::from_string_with_name(matches.value_of("subject"), "sub");
418410
let audience = PayloadItem::from_string_with_name(matches.value_of("audience"), "aud");
419-
let principal = PayloadItem::from_string_with_name(matches.value_of("principal"), "prn");
420-
let mut maybe_payloads: Vec<Option<PayloadItem>> = vec![
421-
issued_at, expires, issuer, subject, audience, principal, not_before,
422-
];
411+
let mut maybe_payloads: Vec<Option<PayloadItem>> =
412+
vec![issued_at, expires, issuer, subject, audience, not_before];
423413

424414
maybe_payloads.append(&mut custom_payloads.unwrap_or_default());
425415
maybe_payloads.append(&mut custom_payload.unwrap_or_default());

tests/jwt-cli.rs

-3
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ mod tests {
213213
"array=[1, 2, 3]",
214214
"-P",
215215
"object={\"foo\": \"bar\"}",
216-
"-p",
217-
"yolo-principal",
218216
"-s",
219217
"yolo-subject",
220218
"{\"test\":\"json value\",\"bool\":true,\"json_number\":1}",
@@ -236,7 +234,6 @@ mod tests {
236234
assert_eq!(header.kid, Some("1234".to_string()));
237235
assert_eq!(claims.0["aud"], "yolo");
238236
assert_eq!(claims.0["iss"], "yolo-service");
239-
assert_eq!(claims.0["prn"], "yolo-principal");
240237
assert_eq!(claims.0["sub"], "yolo-subject");
241238
assert_eq!(claims.0["nbf"], nbf);
242239
assert_eq!(claims.0["exp"], exp);

0 commit comments

Comments
 (0)