-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add support for workload identity federation and consolidate GCP/BigQuery APIs into seperate classes #120
Conversation
6b1eba7
to
6ddbc49
Compare
end | ||
|
||
context 'when authorization endoint returns OK response' do | ||
it 'calls the expected big query apis' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint
end | ||
|
||
context 'when authorization endoint returns OK response' do | ||
let(:events_client) { double(:events_client) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint
|
||
azure_federated_auth: | ||
description: | | ||
Whether to use azure workload identity federation for authentication |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asatwal does this also switch between APIs? If so could we add that to the description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this does switch APIs as the old APIs don't work with the new WIF Auth. Good point I'll add to this description.
|
||
module DfE | ||
module Analytics | ||
# For use with for workload identity federeation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asatwal would it be possible for a team to use this API without WIF? How much effort would it be to add that flexibility? In future I can see the old API being decommissioned and some teams needing to move to the new one but not having been able to get things set up in Azure such that they can use WIF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asatwal I was wondering generally if it's a strong recommend that teams migrate to WIF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is possible to use the new streaming APIs with the old authentication, but this would be effort though. I think we could consider this if there is a real need for this. As Erica points out above, we could insist on WIF initially and it's a strong recommendation.
b7b8206
to
7043e06
Compare
ed2384d
to
3e0087c
Compare
36ae1eb
to
e75f6d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good!
…uery APIs into seperate classes
e75f6d3
to
977c1ae
Compare
Use workload identity federation as an alternative authentication for GCP.
For more details please see GCP documentation here.
Configuration of workload identity federation with Azure and links to the azure documentation can be found here
The steps involved for authentication are shown in the diagram below:
From the diagram, Step 4 is what we have to today with the API key - We go straight to step 4 with the API Key.
So with WIF weeliminate the API Key, but go through Steps 1-3 to get an service account impersonation access token - This replaces the API Key.
This file:
lib/dfe/analytics/azure_federated_auth.rb
implements steps 1-3>
Also the streaming API used to send data to BQ need to be changed.
The old API doesn't work with the new Auth and the new Auth doesn't work with the old API, hence the new event client and the legacy event client.
All config need is from either Azure end variables setup by DevOps:
AZURE_CLIENT_ID
AZURE_FEDERATED_TOKEN_FILE
The rest of the config is from the ENV variable:
GOOGLE_CLOUD_CREDENTIALS
This comes from Google and is a downloadable cloud config.