Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: jans cli to jans-cli-tui #3063

Merged
merged 33 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0b557a3
refactor: remove jans-cli
moabu Nov 22, 2022
98c4dd3
fix: jans-cli no need to get properties each time
devrimyatar Nov 22, 2022
880ab6f
feat: jans-linux-setup tui installer
devrimyatar Nov 22, 2022
e9eaa98
fix: jans-linux-setup clean old cli user data
devrimyatar Nov 22, 2022
a2f17fa
fix: jans-linux-setup missing cli libraries
devrimyatar Nov 22, 2022
bcb9971
fix: jans-cli code clean OrderedDict
devrimyatar Nov 22, 2022
66da3fa
fix: jans-cli runtime plugins
devrimyatar Nov 22, 2022
c67ab39
fix: jans-cli don't decode if access_token_enc is empty
devrimyatar Nov 23, 2022
e2da3fd
fix: jans-cli edit property (ref: #3058)
devrimyatar Nov 23, 2022
0720215
fix: jans-cli screen hangs on scim save (ref: #3061)
devrimyatar Nov 23, 2022
a5e92ad
fix: jans-cli multiple device auth message on save creds (ref: #3059)
devrimyatar Nov 23, 2022
1f06d7c
fix:jans-cli remove unnecessary logs
AbdelwahabAdam Nov 24, 2022
03c25de
fix:jans-cli reviced all array type in properties (ref: #3062)
AbdelwahabAdam Nov 24, 2022
aaf6917
fix:jans-cli fix move backword in auth server column (ref: #\3073)
AbdelwahabAdam Nov 24, 2022
56d3bf4
fix: jans-cli delete if jca_client_secret manually added to config.ini
devrimyatar Nov 24, 2022
63e17c4
fix: jans-cli typo
devrimyatar Nov 24, 2022
2659fb0
fix: jans-cli config-api move to asyncio
devrimyatar Nov 25, 2022
16598f4
fix: jans-cli save admin-ui roles
devrimyatar Nov 25, 2022
e01e1b1
feat: jans-cli display progressing text on status bar
devrimyatar Nov 26, 2022
b7c07e1
feat: jans-cli progressing texts for user plugin
devrimyatar Nov 26, 2022
8213541
fix: jans-cli decode encrypted data if salt changed
devrimyatar Nov 28, 2022
b4b3c16
fix: jans-cli check existence of data when logout (ref: #3050)
devrimyatar Nov 28, 2022
b2fc898
fix:jans-cli getting window too small error in edit user (ref: #3041)
AbdelwahabAdam Nov 28, 2022
43d1d3f
Merge branch 'refactor-jans-cli' of https://github.com/JanssenProject…
AbdelwahabAdam Nov 28, 2022
57caf0e
fix:jans-cli remove un-used scrollbar (ref: #3070 #3041)
AbdelwahabAdam Nov 28, 2022
cafd0c2
feat: jans-cli add User-inum to request headers
devrimyatar Nov 28, 2022
752f141
fix: jans-cli check existence of inum in user info
devrimyatar Nov 28, 2022
54cb7d5
fix: jans-cli DocString (ref: #2572)
AbdelwahabAdam Nov 28, 2022
b381ee5
fix: jans-cli DocString (ref: #2572)
AbdelwahabAdam Nov 29, 2022
7caa495
fix: jans-cli DocString and removing unused imports (ref: #2572)
AbdelwahabAdam Nov 29, 2022
3469e03
fix:jans-cli Ask on delete of scripts conf. properties (ref: #3105)
AbdelwahabAdam Nov 29, 2022
449d954
fix: jans-cli Error on deleting Claims in scopes(ref: #3106)
AbdelwahabAdam Nov 29, 2022
f06753f
fix: jans-cli Error on deleting without verification of deletion (ref…
AbdelwahabAdam Nov 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/jans-fido2/ @yurem
/jans-scim/ @jgomer2001
/jans-config-api/ @pujavs @yuriyz
/jans-cli/ @devrimyatar
/jans-cli-tui/ @devrimyatar
/jans-linux-setup/ @devrimyatar @smansoft @yuriyz @yurem
/jans-linux-setup/jans_setup/setup_app/version.py @moabu
/jans-linux-setup/static/scripts/admin_ui_plugin.py @devrimyatar @duttarnab
Expand Down
52 changes: 26 additions & 26 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
cp -r /opt/dist jans-src/opt/
cp -r /opt/jans jans-src/opt/
touch jans-src/opt/jans/jans-setup/package
rm -rf install.py install jans-cli
rm -rf install.py install jans-cli-tui
rm -rf jans-src/opt/jans/jans-setup/logs/setup.log
rm -rf jans-src/opt/jans/jans-setup/logs/setup_error.log
sed -i "s/%VERSION%/${{ steps.previoustag.outputs.version }}/g" run-build.sh
Expand Down Expand Up @@ -134,10 +134,10 @@ jobs:
make zipapp
mv jans-linux-setup.pyz jans-linux-suse-X86-64-setup.pyz
sha256sum jans-linux-suse-X86-64-setup.pyz > jans-linux-suse-X86-64-setup.pyz.sha256sum
cd ../jans-cli
cd ../jans-cli-tui
make zipapp
mv config-cli.pyz jans-cli-linux-suse-X86-64.pyz
sha256sum jans-cli-linux-suse-X86-64.pyz > jans-cli-linux-suse-X86-64.pyz.sha256sum
mv config-cli.pyz jans-cli-tui-linux-suse-X86-64.pyz
sha256sum jans-cli-tui-linux-suse-X86-64.pyz > jans-cli-tui-linux-suse-X86-64.pyz.sha256sum
# To be removed once we get SUSE build working
- uses: addnab/docker-run-action@v3
name: Build with CentOS7
Expand All @@ -163,10 +163,10 @@ jobs:
make zipapp
mv jans-linux-setup.pyz jans-linux-X86-64-setup.pyz
sha256sum jans-linux-X86-64-setup.pyz > jans-linux-X86-64-setup.pyz.sha256sum
cd ../jans-cli
cd ../jans-cli-tui
make zipapp
mv config-cli.pyz jans-cli-linux-X86-64.pyz
sha256sum jans-cli-linux-X86-64.pyz > jans-cli-linux-X86-64.pyz.sha256sum
mv config-cli.pyz jans-cli-tui-linux-X86-64.pyz
sha256sum jans-cli-tui-linux-X86-64.pyz > jans-cli-tui-linux-X86-64.pyz.sha256sum
- name: Set up Python 3.6
uses: actions/setup-python@v4
with:
Expand All @@ -183,10 +183,10 @@ jobs:
make zipapp
mv jans-linux-setup.pyz jans-linux-ubuntu-X86-64-setup.pyz
sha256sum jans-linux-ubuntu-X86-64-setup.pyz > jans-linux-ubuntu-X86-64-setup.pyz.sha256sum
cd ../jans-cli
cd ../jans-cli-tui
make zipapp
mv config-cli.pyz jans-cli-linux-ubuntu-X86-64.pyz
sha256sum jans-cli-linux-ubuntu-X86-64.pyz > jans-cli-linux-ubuntu-X86-64.pyz.sha256sum
mv config-cli.pyz jans-cli-tui-linux-ubuntu-X86-64.pyz
sha256sum jans-cli-tui-linux-ubuntu-X86-64.pyz > jans-cli-tui-linux-ubuntu-X86-64.pyz.sha256sum
- uses: actions/cache@v3
id: cache-installers
with:
Expand All @@ -197,12 +197,12 @@ jobs:
${{github.workspace}}/jans-linux-setup/jans-linux-suse-X86-64-setup.pyz.sha256sum
${{github.workspace}}/jans-linux-setup/jans-linux-ubuntu-X86-64-setup.pyz
${{github.workspace}}/jans-linux-setup/jans-linux-ubuntu-X86-64-setup.pyz.sha256sum
${{github.workspace}}/jans-cli/jans-cli-linux-X86-64.pyz
${{github.workspace}}/jans-cli/jans-cli-linux-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli/jans-cli-linux-suse-X86-64.pyz
${{github.workspace}}/jans-cli/jans-cli-linux-suse-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli/jans-cli-linux-ubuntu-X86-64.pyz
${{github.workspace}}/jans-cli/jans-cli-linux-ubuntu-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-X86-64.pyz
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-suse-X86-64.pyz
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-suse-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-ubuntu-X86-64.pyz
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-ubuntu-X86-64.pyz.sha256sum
key: ${{ github.sha }}

upload_python_packages:
Expand All @@ -224,12 +224,12 @@ jobs:
${{github.workspace}}/jans-linux-setup/jans-linux-suse-X86-64-setup.pyz.sha256sum
${{github.workspace}}/jans-linux-setup/jans-linux-ubuntu-X86-64-setup.pyz
${{github.workspace}}/jans-linux-setup/jans-linux-ubuntu-X86-64-setup.pyz.sha256sum
${{github.workspace}}/jans-cli/jans-cli-linux-X86-64.pyz
${{github.workspace}}/jans-cli/jans-cli-linux-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli/jans-cli-linux-suse-X86-64.pyz
${{github.workspace}}/jans-cli/jans-cli-linux-suse-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli/jans-cli-linux-ubuntu-X86-64.pyz
${{github.workspace}}/jans-cli/jans-cli-linux-ubuntu-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-X86-64.pyz
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-suse-X86-64.pyz
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-suse-X86-64.pyz.sha256sum
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-ubuntu-X86-64.pyz
${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-ubuntu-X86-64.pyz.sha256sum
key: ${{ github.sha }}
- name: Get latest tag
id: previoustag
Expand Down Expand Up @@ -262,15 +262,15 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.MOAUTO_WORKFLOW_TOKEN }}
file: ${{github.workspace}}/jans-cli/jans-cli-linux-${{ matrix.name }}-X86-64.pyz
asset_name: jans-cli-linux-${{ matrix.name }}-X86-64.pyz
file: ${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-${{ matrix.name }}-X86-64.pyz
asset_name: jans-cli-tui-linux-${{ matrix.name }}-X86-64.pyz
tag: ${{ steps.previoustag.outputs.tag }}
- name: Upload checksum to release
id: upload_shas_cli
continue-on-error: true
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.MOAUTO_WORKFLOW_TOKEN }}
file: ${{github.workspace}}/jans-cli/jans-cli-linux-${{ matrix.name }}-X86-64.pyz.sha256sum
asset_name: jans-cli-linux-${{ matrix.name }}-X86-64.pyz.sha256sum
file: ${{github.workspace}}/jans-cli-tui/jans-cli-tui-linux-${{ matrix.name }}-X86-64.pyz.sha256sum
asset_name: jans-cli-tui-linux-${{ matrix.name }}-X86-64.pyz.sha256sum
tag: ${{ steps.previoustag.outputs.tag }}
20 changes: 10 additions & 10 deletions .github/workflows/central_code_quality_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
- 'jans-eleven/**'
- 'agama/**'
- 'jans-linux-setup/**'
- 'jans-cli/**'
- 'jans-cli-tui/**'
- 'jans-pycloudlib/**'
- '!**/CHANGELOG.md'
- '!**.txt'
Expand All @@ -42,7 +42,7 @@ on:
- 'jans-eleven/**'
- 'agama/**'
- 'jans-linux-setup/**'
- 'jans-cli/**'
- 'jans-cli-tui/**'
- 'jans-pycloudlib/**'
- '!**/CHANGELOG.md'
- '!**.txt'
Expand All @@ -56,7 +56,7 @@ jobs:
strategy:
fail-fast: false
matrix:
module: [jans-auth-server, agama, jans-config-api, jans-core, jans-linux-setup, jans-cli, jans-fido2, jans-notify, jans-orm, jans-scim, jans-eleven, jans-pycloudlib]
module: [jans-auth-server, agama, jans-config-api, jans-core, jans-linux-setup, jans-cli-tui, jans-fido2, jans-notify, jans-orm, jans-scim, jans-eleven, jans-pycloudlib]
env:
JVM_PROJECTS: |
jans-auth-server
Expand All @@ -70,7 +70,7 @@ jobs:
agama
NON_JVM_PROJECTS: |
jans-linux-setup
jans-cli
jans-cli-tui
jans-pycloudlib
steps:
Expand Down Expand Up @@ -112,25 +112,25 @@ jobs:
echo GH sha: $GITHUB_SHA
- name: Set up JDK 11
# JanssenProject/jans-cli is too similar to JanssenProject/jans-client-api as the contains function is returning it belonging to the JVM_PROJECT
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.JVM_PROJECTS, matrix.module) && matrix.module != 'jans-cli'
# JanssenProject/jans-cli-tui is too similar to JanssenProject/jans-client-api as the contains function is returning it belonging to the JVM_PROJECT
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.JVM_PROJECTS, matrix.module) && matrix.module != 'jans-cli-tui'
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'

- name: Cache SonarCloud packages for JVM based project
# JanssenProject/jans-cli is too similar to JanssenProject/jans-client-api as the contains function is returning it belonging to the JVM_PROJECT
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.JVM_PROJECTS, matrix.module) && matrix.module != 'jans-cli'
# JanssenProject/jans-cli-tui is too similar to JanssenProject/jans-client-api as the contains function is returning it belonging to the JVM_PROJECT
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.JVM_PROJECTS, matrix.module) && matrix.module != 'jans-cli-tui'
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Build and analyze JVM based project
# JanssenProject/jans-cli is too similar to JanssenProject/jans-client-api as the contains function is returning it belonging to the JVM_PROJECT
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.JVM_PROJECTS, matrix.module) && matrix.module != 'jans-cli'
# JanssenProject/jans-cli-tui is too similar to JanssenProject/jans-client-api as the contains function is returning it belonging to the JVM_PROJECT
if: contains(env.CHANGED_DIR, matrix.module) && contains(env.JVM_PROJECTS, matrix.module) && matrix.module != 'jans-cli-tui'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
#max-parallel: 1
fail-fast: false
matrix:
python-projects: ["jans-pycloudlib", "jans-cli", "jans-linux-setup"]
python-projects: ["jans-pycloudlib", "jans-cli-tui", "jans-linux-setup"]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions automation/github-labels/labels-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@
"title-prefixes": []
}
},
"comp-jans-cli": {
"comp-jans-cli-tui": {
"color": "0052CC",
"description": "Touching folder /jans-cli",
"description": "Touching folder /jans-cli-tui",
"auto-label": {
"branch": "",
"paths": ["jans-cli"],
"paths": ["jans-cli-tui"],
"title-prefixes": []
}
},
Expand Down
2 changes: 1 addition & 1 deletion docker-jans-persistence-loader/scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def merge_jans_cli_ctx(manager, ctx):
# - move the configs and secrets creation to configurator
# - remove them on future release

# jans-cli client
# jans-cli-tui client
ctx["role_based_client_id"] = manager.config.get("role_based_client_id")
if not ctx["role_based_client_id"]:
ctx["role_based_client_id"] = f"2000.{uuid4()}"
Expand Down
File renamed without changes.
44 changes: 29 additions & 15 deletions jans-cli-tui/cli_tui/cli/config_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/usr/bin/env python3

import sys
import os
import sys

cur_dir = os.path.dirname(os.path.realpath(__file__))
pylib_dir = os.path.join(cur_dir, 'pylib')
if os.path.exists(pylib_dir):
sys.path.insert(0, pylib_dir)

import json
import re
import urllib3
Expand Down Expand Up @@ -37,11 +43,8 @@
config_dir = home_dir.joinpath('.config')
config_dir.mkdir(parents=True, exist_ok=True)
config_ini_fn = config_dir.joinpath('jans-cli.ini')
cur_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(cur_dir)



my_op_mode = 'scim' if 'scim' in os.path.basename(sys.argv[0]) else 'jca'
plugins = []

Expand Down Expand Up @@ -204,13 +207,19 @@ def get_plugin_name_from_title(title):
if config['DEFAULT'].get(secret_key_str):
client_secret = config['DEFAULT'][secret_key_str]
elif config['DEFAULT'].get(secret_enc_key_str):
client_secret_enc = config['DEFAULT'][secret_enc_key_str]
client_secret = unobscure(client_secret_enc)
try:
client_secret_enc = config['DEFAULT'][secret_enc_key_str]
client_secret = unobscure(client_secret_enc)
except Exception:
pass

if 'access_token' in config['DEFAULT']:
if 'access_token' in config['DEFAULT'] and config['DEFAULT']['access_token'].strip():
access_token = config['DEFAULT']['access_token']
elif 'access_token_enc' in config['DEFAULT']:
access_token = unobscure(config['DEFAULT']['access_token_enc'])
elif 'access_token_enc' in config['DEFAULT'] and config['DEFAULT']['access_token_enc'].strip():
try:
access_token = unobscure(config['DEFAULT']['access_token_enc'])
except Exception:
pass

debug = config['DEFAULT'].get('debug')
log_dir = config['DEFAULT'].get('log_dir', log_dir)
Expand Down Expand Up @@ -358,6 +367,10 @@ def get_request_header(self, headers={}, access_token=None):
if not access_token:
access_token = self.access_token

user = self.get_user_info()
if 'inum' in user:
headers['User-inum'] = user['inum']

ret_val = {'Authorization': 'Bearer {}'.format(access_token)}
ret_val.update(headers)
return ret_val
Expand Down Expand Up @@ -459,8 +472,9 @@ def revoke_session(self):

def check_access_token(self):

if not self.access_token :
print(self.colored_text("Access token was not found.", warning_color))
if not self.access_token:
if not self.wrapped:
print(self.colored_text("Access token was not found.", warning_color))
return

try:
Expand All @@ -472,9 +486,9 @@ def check_access_token(self):
}
)
except Exception as e:
print(self.colored_text("Unable to validate access token: {}".format(e), error_color))
self.access_token = None

if not self.wrapped:
print(self.colored_text("Unable to validate access token: {}".format(e), error_color))
self.access_token = None

def validate_date_time(self, date_str):
try:
Expand Down Expand Up @@ -672,7 +686,7 @@ def get_jwt_access_token(self, device_verified=None):
def get_access_token(self, scope):
if self.use_test_client:
self.get_scoped_access_token(scope)
elif not self.access_token:
elif not self.access_token and not self.wrapped:
self.check_access_token()
self.get_jwt_access_token()
return True, ''
Expand Down
Loading