Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
webomagic-auth
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Pratik Shrivastava
webomagic-auth
Commits
7f84ab96
Commit
7f84ab96
authored
Jul 15, 2024
by
deepdey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update config and doc
parent
10b98f4f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
10 deletions
+54
-10
.gitignore
.gitignore
+1
-1
README.md
README.md
+50
-6
app/app_config/config.py
app/app_config/config.py
+3
-3
No files found.
.gitignore
View file @
7f84ab96
...
...
@@ -11,4 +11,4 @@ docs/_build/
*.log
docker-compose.yml
*.tar.gz
.env
\ No newline at end of file
.env*
\ No newline at end of file
README.md
View file @
7f84ab96
...
...
@@ -4,9 +4,53 @@ Flask app to implement auth flow for Webomagic application
Purpose of the application is to restrict api depending on user roles and their privilages.
-
The type convention for endpoints to be followed:
-
`P`
:
`PUBLIC`
- No need to login
-
`V`
:
`PRIVATE`
- Need to login but no role check
-
`SU`
:
``SUPER USER``
- Only accessable by
`super users`
-
`PA`
:
`PROJECT ADMIN`
- Only accesable by
`project admins or above users`
.
-
`RA`
:
`ROLE BASE AUTH`
- Only accesable by
`privilaged user and PA/SU`
.
### Conventions for API Tags
***
-
`P`
:
`PUBLIC`
- No need to login
-
`V`
:
`PRIVATE`
- Need to login but no role check
-
`SU`
:
``SUPER USER``
- Only accessable by
`super users`
-
`PA`
:
`PROJECT ADMIN`
- Only accesable by
`project admins or above users`
.
-
`RA`
:
`ROLE BASE AUTH`
- Only accesable by
`privilaged user and PA/SU`
.
### Installation
***
-
To run the application you can create virtual environment andor directly install requirements in it.
```bash
pip3 install -r requirements.txt
```
-
Create database schema and insert data by running scripts
`database\schema.sql`
and
`database\query.sql`
-
Create a
`.env`
file and add following values in it.
```bash
FLASK_APP=main.py
FLASK_ENV=development
FLASK_DEBUG=1
SERVER_HOST=127.0.0.1
SERVER_PORT=5010
POSTGRES_USER=postgres
POSTGRES_DB=user_db
POSTGRES_HOST=127.0.0.1
POSTGRES_PASSWORD=2580
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_DATABASE=0
LOGGER_PATH=D:/WEBSOFTTECHS/webomagic/Webomagic-User/logs
```
-
Run the application
```bash
python main.py
```
-
Open
`http://<your-host>:<your-port>/webomagic-user/v1/swagger-ui`
in browser.
\ No newline at end of file
app/app_config/config.py
View file @
7f84ab96
...
...
@@ -10,10 +10,10 @@ SERVER_HOST: str = os.environ.get('SERVER_HOST', '0.0.0.0')
SERVER_PORT
:
str
=
os
.
environ
.
get
(
'SERVER_PORT'
,
'5011'
)
POSTGRES
:
dict
=
{
'user'
:
os
.
environ
.
get
(
'POSTGRES_USER'
,
'
webomagic_python_da
'
),
'user'
:
os
.
environ
.
get
(
'POSTGRES_USER'
,
''
),
'db'
:
os
.
environ
.
get
(
'POSTGRES_DB'
,
'user_db'
),
'host'
:
os
.
environ
.
get
(
'POSTGRES_HOST'
,
'127.0.0.1'
),
'password'
:
urllib
.
parse
.
quote
(
os
.
environ
.
get
(
'POSTGRES_PASSWORD'
,
'
P@$$w0rdIITKGP
'
)),
'password'
:
urllib
.
parse
.
quote
(
os
.
environ
.
get
(
'POSTGRES_PASSWORD'
,
''
)),
'port'
:
os
.
environ
.
get
(
'POSTGRES_PORT'
,
'5432'
)
}
DB_URI
:
str
=
'postgresql://
%(user)
s:
%(password)
s@
%(host)
s:
%(port)
s/
%(db)
s'
%
POSTGRES
...
...
@@ -25,7 +25,7 @@ REDIS_PORT = os.environ.get('REDIS_PORT', 6379)
REDIS_DATABASE
=
os
.
environ
.
get
(
'REDIS_DATABASE'
,
0
)
LOGGER_PATH
:
str
=
os
.
environ
.
get
(
'LOGGER_PATH'
,
f
'
/etc/webomagic_user/logs/
'
)
LOGGER_PATH
:
str
=
os
.
environ
.
get
(
'LOGGER_PATH'
,
f
'
{os.getcwd()}{os.sep}logs{os.sep}
'
)
print
(
LOGGER_PATH
)
def
get_logger
(
__name__
:
str
)
->
logging
.
Logger
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment