1
1
#!/usr/bin/env python3
2
2
3
- # All rights reserved. This configuration file is provided to you under the
4
- # terms and conditions of the Eclipse Distribution License v1.0 which
5
- # accompanies this distribution, and is available at
6
- # http://www.eclipse.org/org/documents/edl-v10.php
3
+ ########################################################################
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ # SPDX-License-Identifier: Apache-2.0
17
+ ########################################################################
7
18
8
19
import argparse
9
20
import json
@@ -19,10 +30,7 @@ def createJWTToken(input_filename, priv_key):
19
30
20
31
encoded = jwt .encode (payload , priv_key , algorithm = "RS256" )
21
32
22
- if input_filename .endswith (".json" ):
23
- output_filename = input_filename [:- 5 ] + ".token"
24
- else :
25
- output_filename = output_filename + ".token"
33
+ output_filename = input_filename .removesuffix (".json" ) + ".token"
26
34
27
35
print ("Writing signed access token to {}" .format (output_filename ))
28
36
with open (output_filename , "w" ) as output :
0 commit comments