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

Implement publish button hook #180

Open
blcham opened this issue Jul 11, 2024 · 7 comments
Open

Implement publish button hook #180

blcham opened this issue Jul 11, 2024 · 7 comments
Assignees

Comments

@blcham
Copy link

blcham commented Jul 11, 2024

Image

A/C:

  • publish button triggers post method provided in application.yml (docker-compose.yml) with sample json.
  • configuration to docker-compose is provided here so it calls backend import method
kostobog added a commit to kbss-cvut/record-manager that referenced this issue Jul 11, 2024
kostobog added a commit to kbss-cvut/record-manager that referenced this issue Jul 11, 2024
…othing when publishServiceUrl is not configured.
blcham pushed a commit to kbss-cvut/record-manager that referenced this issue Jul 21, 2024
blcham pushed a commit to kbss-cvut/record-manager that referenced this issue Jul 21, 2024
…othing when publishServiceUrl is not configured.
blcham pushed a commit to kbss-cvut/record-manager that referenced this issue Jul 21, 2024
@blcham blcham assigned blcham and unassigned kostobog Jul 22, 2024
blcham pushed a commit to kbss-cvut/record-manager that referenced this issue Jul 22, 2024
blcham added a commit to kbss-cvut/record-manager that referenced this issue Jul 22, 2024
blcham added a commit that referenced this issue Jul 22, 2024
blcham added a commit that referenced this issue Jul 22, 2024
blcham pushed a commit to kbss-cvut/record-manager that referenced this issue Jul 23, 2024
…(partial)

- it works when calling same docker instance
- records are not yet moved completed --> published
blcham added a commit that referenced this issue Jul 23, 2024
@blcham
Copy link
Author

blcham commented Jul 23, 2024

Current solution:

  • it works when calling the same docker instance
  • records are not yet moved completed --> published

@kostobog kostobog self-assigned this Aug 1, 2024
@blcham
Copy link
Author

blcham commented Aug 1, 2024

Script to forward ports:

#!/bin/bash

REMOTE_GRAPHDB_PORT=5006
LOCAL_GRAPHDB_PORT=5006

# check port availability
#lsof -ti:$LOCAL_GRAPHDB_PORT >/dev/null && echo -e "ERROR: Local port $LOCAL_GRAPHDB_PORT is already in use. Check with command:\nps -AF | grep \`lsof -ti:$LOCAL_GRAPHDB_PORT\`"  && exit

ssh -f -N -L ${LOCAL_GRAPHDB_PORT}:localhost:${REMOTE_GRAPHDB_PORT} kbss.felk.cvut.cz
chromium http://localhost:${LOCAL_GRAPHDB_PORT}

@blcham
Copy link
Author

blcham commented Aug 1, 2024

@kostobog most-likely authorization header contains:

  • client id
  • context (operation to do)
  • authorization token

I would compare authorization headers of the following requests:

  • manual import of operator guy -- operator guy logins to AVA using operator's keycloak instance and uses "import records" button in AVA instance
  • automatic publish method of operator guy -- operator guy logins to AVA using operator's keycloak instance and hits publish button in Operator's instance

Maybe we need to test it first with @PreAuthorize("permitAll()")

@blcham
Copy link
Author

blcham commented Aug 2, 2024

@kostobog
Copy link

@blcham
In kbss-cvut/record-manager#65 it is possible to publish the records to supplier using the publish button in operator.

  • tested with or without permitall. In current version peremitall is removed

The solution requires additional configuration, see kbss-cvut/23ava-distribution#143.

  • PUBLISH_RECORDS_SERVICE_SECRET - specifies the client secret for the server in the supplier.
    • The client_id corresponding to the secret is hardcoded. May be it should be passed as configuration parameter as well?
  • EXCHANGE_TOKEN_SERVICE_URL - this is the oidc service at the supplier which supports token exchange

Currently the variables are set operator's .env

Required Supplier keycloak configuration

The following steps were inspired by 7.3. Internal token to external token exchange. The main difference is that the permissions are added to the identity provider no to the client as is described in the documentation.

  1. Go to record-manager realm, tab Permissions
  2. Make sure Permissions enabled is on.
  3. Click the token-exchange link the Permission list section
  4. Set Decision strategy to Affirmative and save
  5. Click Client details link in the breadcrumb at the top and select Policies tab
  6. Click button to create a policy, from the Policy type choose the Client policy type. Set the name and select the client (record-manager-server) for which the policy applies and save.
  7. Go to the token-exchange permission page, see steps 1-3, select the policy created in step 6. and save.

@blcham
Copy link
Author

blcham commented Oct 10, 2024

@kostobog let's discuss:

The client_id corresponding to the secret is hardcoded. May be it should be passed as configuration parameter as well?

@blcham
Copy link
Author

blcham commented Oct 10, 2024

Documentation about configuration is described in https://github.com/kbss-cvut/23ava-distribution/pull/151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants