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

Release #25

Merged
merged 40 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4e6b9eb
Fix develop dockerfile
daniel-pimenta-DME Jul 5, 2023
918d4c6
Change keycloak urls
daniel-pimenta-DME Jul 5, 2023
ba4b8b6
Fix develop workflow tag
daniel-pimenta-DME Jul 5, 2023
5796045
Fix production workflow
daniel-pimenta-DME Jul 5, 2023
9f4d9c2
Change log message
daniel-pimenta-DME Jul 5, 2023
45704b4
Change config
daniel-pimenta-DME Jul 5, 2023
8fefb80
Add health check
daniel-pimenta-DME Jul 5, 2023
e2b6f3f
Fix health check
daniel-pimenta-DME Jul 5, 2023
e9b702d
Add ready health endpoint
daniel-pimenta-DME Jul 5, 2023
7ad7d20
Fix issue
daniel-pimenta-DME Jul 5, 2023
94c2d7e
Change workflow filenames
daniel-pimenta-DME Jul 5, 2023
4667b27
Eoepca 910 um keycloak develop an identity api based on keycloak api …
flaviorosadme Jul 25, 2023
e8f2581
Update README
daniel-pimenta-DME Aug 21, 2023
7726408
Merge branch 'develop' of https://github.com/EOEPCA/um-identity-api i…
daniel-pimenta-DME Aug 21, 2023
6743f64
Update config
daniel-pimenta-DME Sep 26, 2023
f9c6a84
Update config
daniel-pimenta-DME Sep 26, 2023
8468ce0
Update config
daniel-pimenta-DME Sep 26, 2023
c170db2
Api testing (#18)
flaviorosadme Oct 9, 2023
cf2d35a
Update ci
daniel-pimenta-DME Oct 10, 2023
5eecb1e
Update ci
daniel-pimenta-DME Oct 10, 2023
b6a0828
Release v1.0.0
daniel-pimenta-DME Oct 15, 2023
197b1c0
Fix ci
daniel-pimenta-DME Oct 15, 2023
85b8f27
Fix requirements
daniel-pimenta-DME Oct 15, 2023
5aace57
Fix ci
daniel-pimenta-DME Oct 15, 2023
f0ac15a
Merge branch 'master' into develop
daniel-pimenta-DME Oct 15, 2023
e5559d5
Upgrade flask version
daniel-pimenta-DME Oct 15, 2023
b86284c
Merge branch 'develop' of https://github.com/EOEPCA/um-identity-api i…
daniel-pimenta-DME Oct 15, 2023
df2ec57
Update requirements
daniel-pimenta-DME Oct 15, 2023
de3ee6c
Merge branch 'master' into develop
daniel-pimenta-DME Oct 15, 2023
c19db10
feat: added error handling (#23)
flaviorosadme Oct 16, 2023
7fda506
feat: added validator of register and protect resource enpoint to test
flaviorosadme Oct 18, 2023
9d51ae6
Merge branch 'develop' of https://github.com/EOEPCA/um-identity-api i…
flaviorosadme Oct 18, 2023
ffe7a1d
feat: register and protect resources endpoint working
flaviorosadme Oct 19, 2023
a8c62a6
feat: added delete resources, policies and permissions
flaviorosadme Oct 20, 2023
734244e
Update ci
daniel-pimenta-DME Oct 23, 2023
2de9bfd
Merge branch 'develop' of https://github.com/EOEPCA/um-identity-api i…
daniel-pimenta-DME Oct 23, 2023
acc4fed
Update ci
daniel-pimenta-DME Oct 23, 2023
004b489
Fix ci
daniel-pimenta-DME Oct 24, 2023
9d8c034
Add options method to endpoints
daniel-pimenta-DME Oct 29, 2023
e5cdcae
Merge branch 'master' into develop
daniel-pimenta-DME Oct 29, 2023
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
76 changes: 37 additions & 39 deletions .github/workflows/docker-publish-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ on:
branches: [ "develop" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
GITHUB_REGISTRY: ghcr.io
DOCKER_REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:

Expand Down Expand Up @@ -48,11 +46,11 @@ jobs:

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
- name: Log into registry ${{ env.GITHUB_REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -62,7 +60,7 @@ jobs:
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=develop
type=ref,event=tag
Expand All @@ -81,35 +79,35 @@ jobs:
cache-to: type=gha,mode=max


# # Sign the resulting Docker image digest except on PRs.
# # This will only write to the public Rekor transparency log when the Docker
# # repository is public to avoid leaking data. If you would like to publish
# # transparency data even for private images, pass --force to cosign below.
# # https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# if: ${{ github.event_name != 'pull_request' }}
# env:
# COSIGN_EXPERIMENTAL: "true"
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
#
# - name: Log into registry ${{ env.DOCKER_REGISTRY }}
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - name: Extract metadata (tags, labels) for Docker
# id: docker_meta
# uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
# with:
# images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
#
# - name: Build and push Docker image
# uses: docker/build-push-action@v2
# with:
# context: "{{defaultContext}}"
# push: true
# tags: ${{ steps.docker_meta.outputs.tags }}
# labels: ${{ steps.docker_meta.outputs.labels }}
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}

- name: Log into registry ${{ env.DOCKER_REGISTRY }}
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: docker_meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: "{{defaultContext}}"
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
73 changes: 36 additions & 37 deletions .github/workflows/docker-publish-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ on:
branches: [ "master" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
GITHUB_REGISTRY: ghcr.io
DOCKER_REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}

jobs:
Expand Down Expand Up @@ -48,11 +47,11 @@ jobs:

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
- name: Log into registry ${{ env.GITHUB_REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -62,7 +61,7 @@ jobs:
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=production
type=ref,event=tag
Expand All @@ -80,34 +79,34 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

# # Sign the resulting Docker image digest except on PRs.
# # This will only write to the public Rekor transparency log when the Docker
# # repository is public to avoid leaking data. If you would like to publish
# # transparency data even for private images, pass --force to cosign below.
# # https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# if: ${{ github.event_name != 'pull_request' }}
# env:
# COSIGN_EXPERIMENTAL: "true"
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
#
# - name: Log into registry ${{ env.DOCKER_REGISTRY }}
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Extract metadata (tags, labels) for Docker
# id: docker_meta
# uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
# with:
# images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}
#
# - name: Build and push Docker image
# uses: docker/build-push-action@v2
# with:
# context: "{{defaultContext}}"
# push: true
# tags: ${{ steps.docker_meta.outputs.tags }}
# labels: ${{ steps.docker_meta.outputs.labels }}
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}

- name: Log into registry ${{ env.DOCKER_REGISTRY }}
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: docker_meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: "{{defaultContext}}"
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
18 changes: 9 additions & 9 deletions src/blueprints/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def construct_blueprint(keycloak_client):
keycloak_client = keycloak_client
permissions = Blueprint('permissions', __name__)

@permissions.route("/<client_id>/permissions", methods=["GET"])
@permissions.route("/<client_id>/permissions", methods=["OPTIONS", "GET"])
def get_client_authz_permissions(client_id: str):
try:
response = keycloak_client.get_client_authz_permissions(client_id)
Expand All @@ -16,7 +16,7 @@ def get_client_authz_permissions(client_id: str):
except:
return custom_error("Unknown server error", 500)

@permissions.route("/<client_id>/permissions/management", methods=["GET"])
@permissions.route("/<client_id>/permissions/management", methods=["OPTIONS", "GET"])
def get_client_management_permissions(client_id: str):
try:
response = keycloak_client.get_client_management_permissions(client_id)
Expand All @@ -26,7 +26,7 @@ def get_client_management_permissions(client_id: str):
except:
return custom_error("Unknown server error", 500)

@permissions.route("/<client_id>/permissions/resources", methods=["GET"])
@permissions.route("/<client_id>/permissions/resources", methods=["OPTIONS", "GET"])
def get_client_resource_permissions(client_id: str):
try:
response = keycloak_client.get_client_resource_permissions(client_id)
Expand All @@ -36,16 +36,16 @@ def get_client_resource_permissions(client_id: str):
except:
return custom_error("Unknown server error", 500)

#@permissions.route("/client_authz_scope_permissions/<client_id>/<scope_id>", methods=["GET"])
#@permissions.route("/client_authz_scope_permissions/<client_id>/<scope_id>", methods=["OPTIONS", "GET"])
#def get_client_authz_scope_permissions(client_id: str, scope_id: str):
# return keycloak_client.get_client_authz_scope_permissions(client_id, scope_id)

#@permissions.route("/client_authz_scope_permissions/<client_id>", methods=["POST"])
#@permissions.route("/client_authz_scope_permissions/<client_id>", methods=["OPTIONS", "POST"])
#def create_client_authz_scope_based_permissions(client_id: str):
# payload = request.get_json()
# return keycloak_client.create_client_authz_scope_based_permission(client_id, payload)

@permissions.route("/<client_id>/permissions/resources", methods=["POST"])
@permissions.route("/<client_id>/permissions/resources", methods=["OPTIONS", "POST"])
def create_client_authz_resource_based_permission(client_id: str):
payload = request.get_json()
try:
Expand All @@ -56,7 +56,7 @@ def create_client_authz_resource_based_permission(client_id: str):
except:
return custom_error("Unknown server error", 500)

@permissions.route("/<client_id>/permissions/management", methods=["PUT"])
@permissions.route("/<client_id>/permissions/management", methods=["OPTIONS", "PUT"])
def update_client_management_permissions(client_id: str):
payload = request.get_json()
try:
Expand All @@ -67,7 +67,7 @@ def update_client_management_permissions(client_id: str):
except:
return custom_error("Unknown server error", 500)

@permissions.route("/<client_id>/permissions/resources/<permission_id>", methods=["PUT"])
@permissions.route("/<client_id>/permissions/resources/<permission_id>", methods=["OPTIONS", "PUT"])
def update_client_authz_resource_permission(client_id: str, permission_id):
payload = request.get_json()
try:
Expand All @@ -78,7 +78,7 @@ def update_client_authz_resource_permission(client_id: str, permission_id):
except:
return custom_error("Unknown server error", 500)

#@permissions.route("/<client_id>/permissions/scopes/<scope_id>", methods=["PUT"])
#@permissions.route("/<client_id>/permissions/scopes/<scope_id>", methods=["OPTIONS", "PUT"])
#def update_client_authz_scope_permissions(client_id: str, scope_id):
# payload = request.get_json()
# return keycloak_client.update_client_authz_scope_permission(client_id, payload, scope_id)
Expand Down
12 changes: 6 additions & 6 deletions src/blueprints/policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def construct_blueprint(keycloak_client):
policies = Blueprint('policies', __name__)

# -------- Always returns empty -------
#@policies.route("/policies", methods=["GET"])
#@policies.route("/policies", methods=["OPTIONS", "GET"])
#def get_policies():
# resource = request.args.get('resource', "")
# name = request.args.get('name', "")
Expand All @@ -17,7 +17,7 @@ def construct_blueprint(keycloak_client):
# return keycloak_client.get_policies(resource, name, scope, first, maximum)
# --------------- GET -----------------

@policies.route("/<client_id>/policies", methods=["GET"])
@policies.route("/<client_id>/policies", methods=["OPTIONS", "GET"])
def get_client_authz_policies(client_id: str):
try:
response = keycloak_client.get_client_authz_policies(client_id)
Expand All @@ -29,7 +29,7 @@ def get_client_authz_policies(client_id: str):

# --------------- POST -----------------

@policies.route("/<client_id>/policies/client", methods=["POST"])
@policies.route("/<client_id>/policies/client", methods=["OPTIONS", "POST"])
def create_client_policy(client_id: str):
policy = request.get_json()
try:
Expand Down Expand Up @@ -149,7 +149,7 @@ def create_user_policy(client_id: str):

# --------------- UPDATE -----------------

@policies.route("/<client_id>/policies/<policy_id>", methods=["PUT"])
@policies.route("/<client_id>/policies/<policy_id>", methods=["OPTIONS", "PUT"])
def update_policy(client_id: str, policy_id: str):
policy = request.get_json()
try:
Expand All @@ -162,7 +162,7 @@ def update_policy(client_id: str, policy_id: str):

# --------------- DELETE -----------------

@policies.route("/<client_id>/policies/<policy_id>", methods=["DELETE"])
@policies.route("/<client_id>/policies/<policy_id>", methods=["OPTIONS", "DELETE"])
def delete_policy(client_id: str ,policy_id: str):
try:
response = keycloak_client.delete_policy(policy_id, client_id)
Expand All @@ -175,4 +175,4 @@ def delete_policy(client_id: str ,policy_id: str):
def custom_error(message, status_code):
return message, status_code

return policies
return policies
Loading
Loading