Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alternate-mdx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Trust and Identity Incubator
alternate-mdx
Commits
bd647b2e
Commit
bd647b2e
authored
3 years ago
by
Martin van Es
Browse files
Options
Downloads
Patches
Plain Diff
Make proxy domains configurable
parent
d963b10c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
README.md
+3
-2
3 additions, 2 deletions
README.md
mdproxy.py
+3
-3
3 additions, 3 deletions
mdproxy.py
mdproxy.yaml.example
+5
-0
5 additions, 0 deletions
mdproxy.yaml.example
mdserver.py
+2
-2
2 additions, 2 deletions
mdserver.py
utils.py
+2
-2
2 additions, 2 deletions
utils.py
with
15 additions
and
9 deletions
README.md
+
3
−
2
View file @
bd647b2e
...
...
@@ -22,13 +22,14 @@ Reloads metadata on inotify CLOSE_WRITE of metadata file.
Serves and caches signed by domain signer from memory, on request
## ```mdproxy.py```
Reads config from mdproxy.yaml configuration, see example.
Caches signed and cached
```mdserver.py```
metadata requests
## Queries
MDQ Queries can then be pointed at
-
```http://mdserver:5001/
sign
/<entityid>```
-
```http://mdproxy:5002/
cache
/<entityid>```
-
```http://mdserver:5001/
<domain>/entities
/<entityid>```
-
```http://mdproxy:5002/
<domain>/entities
/<entityid>```
## Bootstrap softHSM2
This is a very brief summary of the successive commands to initialize softHSM2 for testing. Tested on Ubuntu 21.10.
...
...
This diff is collapsed.
Click to expand it.
mdproxy.py
+
3
−
3
View file @
bd647b2e
...
...
@@ -6,14 +6,14 @@ from urllib.parse import unquote
from
dateutil
import
parser
,
tz
from
datetime
import
datetime
from
utils
import
hasher
,
Entity
from
utils
import
read_config
,
hasher
,
Entity
config
=
read_config
(
'
mdproxy.yaml
'
)
app
=
Flask
(
__name__
)
# Find all IdP's in edugain metadata
cached
=
{}
signer_url
=
'
http://localhost:5001
'
@app.route
(
'
/<domain>/entities/<path:eid>
'
,
methods
=
[
'
GET
'
])
...
...
@@ -35,7 +35,7 @@ def serve(domain, eid):
return
cached
[
domain
][
entityID
].
md
else
:
print
(
f
"
request
{
entityID
}
"
)
data
=
requests
.
get
(
f
"
{
signer
_url
}
/
{
domain
}
/entities/{{sha1}}
{
entityID
}
"
).
text
data
=
requests
.
get
(
f
"
{
config
[
domain
][
'
signer
'
]
}
/
{
domain
}
/entities/{{sha1}}
{
entityID
}
"
).
text
try
:
parsed
=
ET
.
fromstring
(
data
)
validUntil
=
parsed
.
get
(
'
validUntil
'
)
...
...
This diff is collapsed.
Click to expand it.
mdproxy.yaml.example
0 → 100644
+
5
−
0
View file @
bd647b2e
---
test:
signer: 'http://localhost:5001'
foobar:
signer: 'http://localhost:5001'
This diff is collapsed.
Click to expand it.
mdserver.py
+
2
−
2
View file @
bd647b2e
...
...
@@ -2,7 +2,7 @@
from
utils
import
read_config
,
Resource
,
Server
from
flask
import
Flask
,
Response
config
=
read_config
()
config
=
read_config
(
'
mdserver.yaml
'
)
app
=
Flask
(
__name__
)
server
=
Server
()
...
...
@@ -31,4 +31,4 @@ for domain, values in config.items():
if
__name__
==
"
__main__
"
:
app
.
run
(
host
=
'
127
.0.0.
1
'
,
port
=
5001
,
debug
=
False
)
app
.
run
(
host
=
'
0
.0.0.
0
'
,
port
=
5001
,
debug
=
False
)
This diff is collapsed.
Click to expand it.
utils.py
+
2
−
2
View file @
bd647b2e
...
...
@@ -13,8 +13,8 @@ from signers import Signers
# watch_manager = pyinotify.WatchManager()
def
read_config
():
with
open
(
'
mdserver.yaml
'
)
as
f
:
def
read_config
(
config
):
with
open
(
config
)
as
f
:
config
=
yaml
.
safe_load
(
f
)
return
config
...
...
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