Skip to content

Commit

Permalink
Merge pull request #8 from GenomicDataInfrastructure/7-gdi-dataset-di…
Browse files Browse the repository at this point in the history
…scovery-service-spike-how-are-ls-aai-access-token-passport-and-visas-retrieved-via-keycloak

7 gdi dataset discovery service spike how are ls aai access token passport and visas retrieved via keycloak
  • Loading branch information
brunopacheco1 authored Apr 5, 2024
2 parents e3e94f9 + 02f043b commit 560f13d
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 5 deletions.
8 changes: 8 additions & 0 deletions _http/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0

KEYCLOAK_HOST=https://keycloak-test.healthdata.nl
KEYCLOAK_REALM=ckan
KEYCLOAK_PROVIDER_ALIAS=LSAAI
ACCESS_TOKEN=dummy
4 changes: 0 additions & 4 deletions _http/.gitignore

This file was deleted.

6 changes: 6 additions & 0 deletions _http/keycloak.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0

GET {{$dotenv KEYCLOAK_HOST}}/realms/{{$dotenv KEYCLOAK_REALM}}/broker/{{$dotenv KEYCLOAK_PROVIDER_ALIAS}}/token
Authorization: Bearer {{$dotenv ACCESS_TOKEN}}
18 changes: 18 additions & 0 deletions src/main/openapi/beacon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ paths:
post:
summary: Searches for individuals based on criteria
operationId: list_individuals
parameters:
- name: Authorization
in: header
description: The authorization header
required: true
schema:
type: string
tags:
- "beacon-query"
requestBody:
Expand All @@ -28,6 +35,8 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/BeaconIndividualsResponse"
"401":
description: "Unauthorized"
security:
- beacon_auth:
- read:beacon
Expand All @@ -37,13 +46,22 @@ paths:
operationId: list_filtering_terms
tags:
- "beacon-query"
parameters:
- name: Authorization
in: header
description: The authorization header
required: true
schema:
type: string
responses:
"200":
description: A list of filtering terms
content:
application/json:
schema:
$ref: "#/components/schemas/BeaconFilteringTermsResponse"
"401":
description: "Unauthorized"
security:
- beacon_auth:
- read:beacon
Expand Down
12 changes: 12 additions & 0 deletions src/main/openapi/ckan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ paths:
required: false
schema:
type: string
- name: Authorization
in: header
description: The authorization header
required: false
schema:
type: string
responses:
"200":
description: A list of packages matching the search criteria
Expand All @@ -80,6 +86,12 @@ paths:
required: true
schema:
type: string
- name: Authorization
in: header
description: The authorization header
required: false
schema:
type: string
responses:
"200":
description: The package with the specified ID
Expand Down
82 changes: 82 additions & 0 deletions src/main/openapi/keycloak.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0

openapi: 3.0.3
info:
title: Keycloak API
version: 1.0.0
description: This API allows to query the Keycloak identity provider
servers:
- url: /
paths:
/broker/{providerAlias}/token:
get:
summary: Retrieves tokens from the identity provider
operationId: retrive_idp_tokens
tags:
- "keycloak-query"
parameters:
- name: providerAlias
in: path
description: The alias of the identity provider
required: true
schema:
type: string
- name: Autorization
in: header
description: The authorization header
required: true
schema:
type: string
responses:
"200":
description: A list of packages matching the search criteria
content:
application/json:
schema:
$ref: "#/components/schemas/KeycloakTokenResponse"
"401":
description: "Unauthorized"
security:
- keycloak_auth:
- read:token
components:
securitySchemes:
keycloak_auth:
type: oauth2
description: This API uses OAuth 2 with the implicit grant flow.
flows:
authorizationCode:
tokenUrl: https://api.example.com/oauth2/token
authorizationUrl: https://api.example.com/oauth2/authorize
scopes:
read:token: read tokens
schemas:
KeycloakTokenResponse:
type: object
properties:
access_token:
type: string
title: The access token
expires_in:
type: integer
title: The expiration time of the token
refresh_expires_in:
type: integer
title: The expiration time of the refresh token
token_type:
type: string
title: The type of the token
id_token:
type: string
title: The ID token
not-before-policy:
type: integer
title: The not-before policy
scope:
type: string
title: The scope of the token
accessTokenExpiration:
type: integer
title: The expiration time of the access token
8 changes: 7 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ quarkus.keycloak.devservices.port=32794
quarkus.wiremock.devservices.port=4000
quarkus.oidc.client-id=backend-service
quarkus.oidc.credentials.secret=secret
# Enable Policy Enforcement
quarkus.openapi-generator.codegen.spec.discovery_yaml.enable-security-generation=false
quarkus.openapi-generator.codegen.spec.discovery_yaml.additional-model-type-annotations=@lombok.Data;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor;@lombok.Builder
quarkus.openapi-generator.codegen.spec.discovery_yaml.base-package=io.github.genomicdatainfrastructure.discovery
Expand All @@ -25,3 +24,10 @@ quarkus.openapi-generator.codegen.spec.beacon_yaml.enable-security-generation=fa
quarkus.openapi-generator.codegen.spec.beacon_yaml.base-package=io.github.genomicdatainfrastructure.discovery.remote.beacon
quarkus.openapi-generator.codegen.spec.beacon_yaml.additional-model-type-annotations=@lombok.Data;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor;@lombok.Builder
quarkus.openapi-generator.codegen.spec.beacon_yaml.generate-part-filename=false
quarkus.openapi-generator.codegen.spec.keycloak_yaml.enable-security-generation=false
quarkus.openapi-generator.codegen.spec.keycloak_yaml.base-package=io.github.genomicdatainfrastructure.discovery.remote.keycloak
quarkus.openapi-generator.codegen.spec.keycloak_yaml.additional-model-type-annotations=@lombok.Data;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor;@lombok.Builder
quarkus.openapi-generator.codegen.spec.keycloak_yaml.generate-part-filename=false
quarkus.rest-client.ckan_yaml.url=http://localhost:4000
quarkus.rest-client.keycloak_yaml.url=http://localhost:4000
quarkus.rest-client.beacon_yaml.url=http://localhost:4000

0 comments on commit 560f13d

Please sign in to comment.