Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jitsi-cert-auth
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Hartig
jitsi-cert-auth
Commits
ed83e8b0
Commit
ed83e8b0
authored
2 years ago
by
Jan Hartig
Browse files
Options
Downloads
Patches
Plain Diff
Replace DN Regex to support more certificates
parent
f2fe4c53
No related branches found
No related tags found
1 merge request
!17
Develop
Pipeline
#16176
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server.py
+5
-10
5 additions, 10 deletions
server.py
with
5 additions
and
10 deletions
server.py
+
5
−
10
View file @
ed83e8b0
...
...
@@ -2,7 +2,6 @@
import
hmac
import
json
from
base64
import
urlsafe_b64encode
from
re
import
compile
from
time
import
time
from
urllib.parse
import
quote
...
...
@@ -21,8 +20,6 @@ SANIC_JITSI_APP_SECRET: Jitsi App Secret
SANIC_TOKEN_VALID_FOR: Time in seconds generated JWT will be valid for
'''
re_dn
=
compile
(
"
CN=([^,]+).+,O=Physikalisch-Technische Bundesanstalt.+C=DE
"
)
# Static token header string
header
=
json
.
dumps
({
"
typ
"
:
"
JWT
"
,
...
...
@@ -36,15 +33,13 @@ async def cert2room(request):
serial
=
request
.
headers
.
get
(
"
SSL-Client-Serial
"
)
if
s_dn
and
serial
:
#
Additional cert validation based on regex
match
=
re_dn
.
search
(
s_dn
)
#
Turn distinguished names string into dict
dn
=
dict
(
item
.
split
(
"
=
"
)
for
item
in
s_dn
.
split
(
"
,
"
)
)
if
not
match
:
# Check if User is PTB
if
not
dn
[
"
O
"
]
==
"
Physikalisch-Technische Bundesanstalt
"
:
raise
Unauthorized
(
"
Unauthorized
"
)
# Get user's name from regex match
name
=
match
.
groups
()[
0
]
# Get user's room & email from json file
try
:
room
=
await
get_user_data
(
serial
)
...
...
@@ -55,7 +50,7 @@ async def cert2room(request):
except
KeyError
:
# Serial not found, build room from name
room
=
name
room
=
dn
[
"
CN
"
]
# Make room name url-safe
room
=
quote
(
room
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment