Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
createToken.py: Fix typo output_filename => input_filename
Browse files Browse the repository at this point in the history
output_filename is not defined in else branch. Most likely author
wanted to use input_filename instead
  • Loading branch information
landgraf committed Sep 21, 2023
1 parent 9f67867 commit 3f12f9e
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions kuksa_certificates/jwt/createToken.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
#!/usr/bin/env python3

# All rights reserved. This configuration file is provided to you under the
# terms and conditions of the Eclipse Distribution License v1.0 which
# accompanies this distribution, and is available at
# http://www.eclipse.org/org/documents/edl-v10.php
########################################################################
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
########################################################################

import argparse
import json
Expand All @@ -19,10 +30,7 @@ def createJWTToken(input_filename, priv_key):

encoded = jwt.encode(payload, priv_key, algorithm="RS256")

if input_filename.endswith(".json"):
output_filename = input_filename[:-5] + ".token"
else:
output_filename = output_filename + ".token"
output_filename = input_filename.removesuffix(".json") + ".token"

print("Writing signed access token to {}".format(output_filename))
with open(output_filename, "w") as output:
Expand Down

0 comments on commit 3f12f9e

Please sign in to comment.