Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
ws-eidaauth
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OSUG
RESIF
ws-eidaauth
Commits
78825940
Commit
78825940
authored
Jul 10, 2020
by
Jonathan Schaeffer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename database parameters
parent
05c931b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
29 deletions
+29
-29
eidawsauth/eidawsauth.py
eidawsauth/eidawsauth.py
+29
-29
No files found.
eidawsauth/eidawsauth.py
View file @
78825940
...
...
@@ -59,18 +59,18 @@ def register_login(login, password):
"""
expiration_time
=
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
days
=
1
)
try
:
conn
=
psycopg2
.
connect
(
dbname
=
application
.
config
[
'
AUTHDBNAM
E'
],
port
=
application
.
config
[
'
AUTHDB
PORT'
],
host
=
application
.
config
[
'
AUTHDB
HOST'
],
user
=
application
.
config
[
'
AUTHDB
USER'
],
password
=
application
.
config
[
'
AUTHDB
PASSWORD'
])
conn
=
psycopg2
.
connect
(
dbname
=
application
.
config
[
'
RESIFAUTH_PGDATABAS
E'
],
port
=
application
.
config
[
'
RESIFAUTH_PG
PORT'
],
host
=
application
.
config
[
'
RESIFAUTH_PG
HOST'
],
user
=
application
.
config
[
'
RESIFAUTH_PG
USER'
],
password
=
application
.
config
[
'
RESIFAUTH_PG
PASSWORD'
])
cur
=
conn
.
cursor
()
logging
.
debug
(
"Connected to users database"
)
except
Exception
as
e
:
logging
.
error
(
"Unable to connect to database %s as %s@%s:%s"
%
(
application
.
config
[
'AUTHDBNAM
E'
],
application
.
config
[
'
AUTHDB
USER'
],
application
.
config
[
'
AUTHDB
HOST'
],
application
.
config
[
'
AUTHDBPORT'
])
)
logging
.
error
(
"Unable to connect to database %s as %s@%s:%s"
,
application
.
config
[
'RESIFAUTH_PGDATABAS
E'
],
application
.
config
[
'
RESIFAUTH_PG
USER'
],
application
.
config
[
'
RESIFAUTH_PG
HOST'
],
application
.
config
[
'
RESIFAUTH_PGPORT'
]
)
raise
e
cur
.
execute
(
"""
...
...
@@ -93,18 +93,18 @@ def register_privileges(login, fdsn_refs):
- For each fdsn reference, insert the privilege in the access table
"""
try
:
conn
=
psycopg2
.
connect
(
dbname
=
application
.
config
[
'
PRIVILEGEDBNAM
E'
],
port
=
application
.
config
[
'
PRIVILEGEDB
PORT'
],
host
=
application
.
config
[
'
PRIVILEGEDB
HOST'
],
user
=
application
.
config
[
'
PRIVILEGEDB
USER'
],
password
=
application
.
config
[
'
PRIVILEGEDB
PASSWORD'
])
conn
=
psycopg2
.
connect
(
dbname
=
application
.
config
[
'
RESIFINV_PGDATABAS
E'
],
port
=
application
.
config
[
'
RESIFINV_PG
PORT'
],
host
=
application
.
config
[
'
RESIFINV_PG
HOST'
],
user
=
application
.
config
[
'
RESIFINV_PG
USER'
],
password
=
application
.
config
[
'
RESIFINV_PG
PASSWORD'
])
cur
=
conn
.
cursor
()
logging
.
debug
(
"Connected to privileges database"
)
except
Exception
as
e
:
logging
.
error
(
"Unable to connect to database %s as %s@%s:%s"
%
(
application
.
config
[
'PRIVILEGEDBNAM
E'
],
application
.
config
[
'
PRIVILEGEDB
USER'
],
application
.
config
[
'
PRIVILEGEDB
HOST'
],
application
.
config
[
'
PRIVILEGEDBPORT'
])
)
logging
.
error
(
"Unable to connect to database %s as %s@%s:%s"
,
application
.
config
[
'RESIFINV_PGDATABAS
E'
],
application
.
config
[
'
RESIFINV_PG
USER'
],
application
.
config
[
'
RESIFINV_PG
HOST'
],
application
.
config
[
'
RESIFINV_PGPORT'
]
)
raise
e
# Get the network id
...
...
@@ -143,11 +143,11 @@ def cleanup():
logging
.
info
(
"Cleaning up expired temporary accounts"
)
rows_deleted
=
0
try
:
conn
=
psycopg2
.
connect
(
dbname
=
application
.
config
[
'
AUTHDBNAM
E'
],
port
=
application
.
config
[
'
AUTHDB
PORT'
],
host
=
application
.
config
[
'
AUTHDB
HOST'
],
user
=
application
.
config
[
'
AUTHDB
USER'
],
password
=
application
.
config
[
'
AUTHDB
PASSWORD'
])
conn
=
psycopg2
.
connect
(
dbname
=
application
.
config
[
'
RESIFAUTH_PGDATABAS
E'
],
port
=
application
.
config
[
'
RESIFAUTH_PG
PORT'
],
host
=
application
.
config
[
'
RESIFAUTH_PG
HOST'
],
user
=
application
.
config
[
'
RESIFAUTH_PG
USER'
],
password
=
application
.
config
[
'
RESIFAUTH_PG
PASSWORD'
])
cur
=
conn
.
cursor
()
logging
.
debug
(
"Connected to users database"
)
cur
.
execute
(
"delete from credentials where expires_at < now();"
)
...
...
@@ -160,11 +160,11 @@ def cleanup():
raise
e
try
:
conn
=
psycopg2
.
connect
(
dbname
=
application
.
config
[
'
PRIVILEGEDBNAM
E'
],
port
=
application
.
config
[
'PRIVILEGEDB
PORT'
],
host
=
application
.
config
[
'PRIVILEGEDB
HOST'
],
user
=
application
.
config
[
'PRIVILEGEDB
USER'
],
password
=
application
.
config
[
'PRIVILEGEDB
PASSWORD'
])
conn
=
psycopg2
.
connect
(
dbname
=
application
.
config
[
'
RESIFINV_PGDATABAS
E'
],
port
=
application
.
config
[
'RESIFINV_PG
PORT'
],
host
=
application
.
config
[
'RESIFINV_PG
HOST'
],
user
=
application
.
config
[
'RESIFINV_PG
USER'
],
password
=
application
.
config
[
'RESIFINV_PG
PASSWORD'
])
cur
=
conn
.
cursor
()
logging
.
debug
(
"Connected to privlieges database"
)
logging
.
debug
(
"Deleting from privileges database"
)
...
...
@@ -184,7 +184,7 @@ def auth():
data
=
request
.
get_data
()
logging
.
debug
(
"Data: %s"
,
data
)
try
:
verify_token_signature
(
data
,
application
.
config
[
'GNUPGHOMEDIR'
])
verify_token_signature
(
data
,
application
.
config
[
'GNUPG
_
HOMEDIR'
])
tokendict
=
parse_input_data
(
data
)
logging
.
info
(
"Token signature OK: %s"
%
str
(
tokendict
))
except
ValueError
as
e
:
...
...
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