Skip to content

Commit e485096

Browse files
authored
Merge pull request #85 from DrDaveD/v1.20
Improve httokensh, add man pages, update to v1.20
2 parents 664f2e6 + ba808bd commit e485096

14 files changed

+631
-33
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
VERSION := $(shell sed -n 's/^Version: //p' htgettoken.spec)
22

3-
htgettoken.html: htgettoken.1
4-
groff -mandoc -Thtml htgettoken.1 >htgettoken.html
3+
man: htgettoken.html htdestroytoken.html htdecodetoken.html httokensh.html
4+
5+
%.html : %.1
6+
groff -mandoc -Thtml $< >$@
57

68
# For koji builds
79
sources:

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,17 @@ submitted to
2929
for a description of htgettoken, htvault-config, and their HTCondor
3030
integration.
3131

32-
## httokendecode
32+
## additional commands
3333

34-
An additional small script called `httokendecode` is bundled with
35-
`htgettoken`. It decodes JSON Web Tokens that it finds either according
36-
to a given filename (`-` for stdin) or based on the
37-
[WLCG Bearer Token Discovery](https://zenodo.org/record/3937438#.YUDw7aBOlTY)
38-
standard if no filename is given.
34+
A few additional helpful commands are bundled with htgettoken.
35+
Click on each one below to see their man pages.
36+
37+
- [htdecodetoken/httokendecode](https://htmlpreview.github.io/?https://github.com/fermitools/htgettoken/blob/master/htdecodetoken.html) --
38+
decodes JSON Web Tokens that it finds either according to a given
39+
filename or based on the
40+
[WLCG Bearer Token Discovery](https://zenodo.org/record/3937438#.YUDw7aBOlTY)
41+
standard if no filename is given.
42+
- [htdestroytoken](https://htmlpreview.github.io/?https://github.com/fermitools/htgettoken/blob/master/htdestroytoken.html) --
43+
removes bearer and vault tokens
44+
- [httokensh](https://htmlpreview.github.io/?https://github.com/fermitools/htgettoken/blob/master/httokensh.html) --
45+
keeps the bearer token renewed as long as a command it starts runs

httokendecode renamed to htdecodetoken

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
usage()
88
{
9-
echo 'Usage: httokendecode [-a] [-H] [file]'
9+
echo 'Usage: htdecodetoken [-a] [-H] [file]'
1010
echo
1111
echo 'Decodes a JSON Web Token'
1212
echo ' -a: show algorithm portion of JWT'

htdecodetoken.1

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.TH htdecodetoken 1
2+
.SH NAME
3+
htdecodetoken \- decode JSON Web Token
4+
5+
.SH SYNOPSIS
6+
.B htdecodetoken
7+
[-a] [-H] [file]
8+
.PP
9+
.B httokendecode
10+
[-a] [-H] [file]
11+
12+
.SH DESCRIPTION
13+
.B htdecodetoken
14+
(also known as
15+
.BR httokendecode )
16+
decodes a JSON Web Token (JWT) and prints the JSON output to standard
17+
output.
18+
If a file name provided is "-" it reads the JWT from standard input.
19+
If no file name is given, it follows the WLCG Bearer Token Discovery
20+
protocol, which is to first try reading the token from $BEARER_TOKEN,
21+
next reading the token from the file defined in $BEARER_TOKEN_FILE,
22+
and finally reading from a file called "bt_u`id -u`" either in
23+
$XDG_RUNTIME_DIR if it is defined or else in /tmp.
24+
25+
If the
26+
.B scitokens-verify
27+
command is found in $PATH, then after decode that command is also run
28+
and will print an error if the JWT is not found to be currently valid.
29+
30+
.SH OPTIONS
31+
The following options are recognized:
32+
.PP
33+
.TP
34+
.B \-a
35+
Additionally shows the algorithm portion of the JWT in a separate JSON
36+
structure printed first to standard output.
37+
.TP
38+
.B \-H
39+
Prints scopes (specifically "nbf", "iat", and "exp")
40+
that are normally shown in Epoch time
41+
(seconds since the beginning of 1970)
42+
instead in the human-readable form used by default by the
43+
.B date
44+
command.
45+
46+
.SH AUTHOR
47+
Dave Dykstra
48+
49+
.SH COPYRIGHT
50+
Copyright \(co 2023 Fermi National Accelerator Laboratory
51+
52+
.SH "SEE ALSO"
53+
htgettoken(1)

htdecodetoken.html

Lines changed: 143 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

htdestroytoken.1

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.TH htdestroytoken 1
2+
.SH NAME
3+
htdestroytoken \- remove bearer and vault tokens
4+
5+
.SH SYNOPSIS
6+
.B htdestroytoken
7+
[-q]
8+
9+
.SH DESCRIPTION
10+
.B htdestroytoken
11+
removes a bearer token found by WLCG Bearer Token Discovery and also
12+
removes a vault token found in the default location used by
13+
.BR htgettoken.
14+
15+
Note that the vault server additionally caches bearer tokens, so the
16+
next time that
17+
.B htgettoken
18+
is run the same bearer token might be returned unless a new one is
19+
forced to be retrieved with either oidc authentication or with an
20+
htgettoken
21+
.I \-\-minsecs
22+
option.
23+
24+
.SH OPTIONS
25+
The following options are recognized:
26+
.PP
27+
.TP
28+
.BR \-q
29+
Do removals silently
30+
31+
.SH AUTHOR
32+
Dave Dykstra
33+
34+
.SH COPYRIGHT
35+
Copyright \(co 2023 Fermi National Accelerator Laboratory
36+
37+
.SH "SEE ALSO"
38+
htgettoken(1), htdecodetoken(1)

0 commit comments

Comments
 (0)