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

✨🔧 452 - [Feature branch] - Add ega permissions integration #457

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from

Conversation

anncatton
Copy link
Contributor

@anncatton anncatton commented Sep 17, 2024

Note: This will be the base branch for work associated with the new EGA permissions flow.

Adds initial setup for EGA API client.

EGA Job

  • updates config.ts to include values for EGA APIs
  • adds axios clients for EGA auth server and API
  • creates client for interacting with EGA API, including fetching an access token from auth server
  • adds initial logic for refreshing the access token, using Axios interceptors. Will need to expand this to address multiple concurrent requests!
  • adds constants for API paths

Documentation

  • adds a new section for environment variables in the README. For now, just added the vars related to EGA. Will add remaining values in a cleanup ticket, as some of them are likely to be removed (i.e. Vault values)
  • updates .env.example file

Docker Compose

  • adds specific version for Vault image, there is no latest image available on dockerhub
  • changes mailhog image to a forked version to allow building Multi Arch Docker images: https://hub.docker.com/r/jcalonso/mailhog
  • modifies Makefile scripts to match updated Docker executable

Dependencies

  • adds axios and types support for jsonwebtoken

Cleanup

  • unrelated to ticket, moves some utils functions from the router file (applications.ts) to their own file

@anncatton anncatton marked this pull request as ready for review September 23, 2024 12:41
@anncatton anncatton changed the title ✨🔧 452 - Add ega client ✨🔧 452 - Add ega permissions integration Sep 24, 2024
Copy link
Member

@joneubank joneubank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments are about code strictness and readability/maintainability. There's nothing very functional happening here to request changes for.

DACO_UI_BASE_URL=https://dac.dev.argo.cancercollaboratory.org
DACO_UI_BASE_URL=http://localhost:3000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for removing specific system references.

README.md Outdated
Comment on lines 11 to 21
## Environment Variables

| Name | Description | Type | Required | Default |
| ------------------- | ----------------------------------------------------------------------------- | -------- | -------- | ------- |
| EGA_CLIENT_ID | Client ID for EGA API | `string` | true | |
| EGA_AUTH_HOST | Root URL for EGA authentication server | `string` | true | |
| EGA_AUTH_REALM_NAME | Realm name for EGA authentication server | `string` | true | |
| EGA_API_URL | Root URL for EGA API | `string` | true | |
| EGA_USERNAME | Username for account used to gain access token from EGA authentication server | `string` | true | |
| EGA_PASSWORD | Password for account used to gain access token from EGA authentication server | `string` | true | |

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

},
);

const token = response.data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data has type any. Are we planning to ensure that the response data matches the type IdpToken?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm adding Zod in the next PR, i will add a safeParse call for this and the refreshToken return

},
);

return response.data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeat comment, data has type any.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix as in above comment

Comment on lines 147 to 150
const getDacs = async () => {
const response = await apiAxiosClient.get('/dacs');
return response.data;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getDacs: () => Promise<any> and no comments. Can you add tsdocs to this so I know what this is supposed to be returning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be removed in the next PR!


import { BadRequest } from '../utils/errors';

export function validateId(id: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TSDocs please, no idea what this is validating or when to use.

return id;
}

export function validateType(type: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TSDocs please, no idea what this is validating or when to use.

Comment on lines +282 to +289
export const EGA_API = {
DACS: 'dacs',
PERMISSIONS: 'permissions',
USERS: 'users',
MEMBERS: 'members',
REQUESTS: 'requests',
DATASETS: 'datasets',
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the use of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are pathnames for the ega api requests, they'll come into play in the next PR(s). I'll add a comment tho

@anncatton anncatton mentioned this pull request Sep 26, 2024
@joneubank
Copy link
Member

Before you merge this, you mentioned "Next PR" a couple times, should we be collecting this work into a larger feature branch?

@anncatton
Copy link
Contributor Author

anncatton commented Sep 30, 2024

Before you merge this, you mentioned "Next PR" a couple times, should we be collecting this work into a larger feature branch?

My plan was to use this branch as the feature branch - the "next PR" is the work for #453 (#458), which uses this as its base branch.

@anncatton anncatton changed the title ✨🔧 452 - Add ega permissions integration ✨🔧 452 - [Feature branch] - Add ega permissions integration Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants