Skip to content

Commit

Permalink
fix(amazon/loadBalancer): Make sure oidc actions have client secret (s…
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Reynolds authored Jun 27, 2018
1 parent 0ee1800 commit 693803f
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,31 @@ class ALBListenersImpl extends React.Component<
});
}

private attachClientSecret = (action: IListenerAction, oidcConfigs: IAuthenticateOidcActionConfig[]) => {
if (action.type === 'authenticate-oidc') {
const config = oidcConfigs.find(c => c.clientId === action.authenticateOidcConfig.clientId);
if (config) {
action.authenticateOidcConfig.clientSecret = config.clientSecret;
}
}
};

private loadOidcClients(): void {
OidcConfigReader.getOidcConfigsByApp(this.props.app.name)
.then(oidcConfigs => this.setState({ oidcConfigs }))
.then(oidcConfigs => {
// make sure we have all the secrets for listener actions that need them
if (oidcConfigs && oidcConfigs.length) {
this.props.values.listeners.forEach(listener => {
listener.defaultActions.forEach(action => this.attachClientSecret(action, oidcConfigs));
listener.rules.forEach(rule =>
rule.actions.forEach(action => this.attachClientSecret(action, oidcConfigs)),
);
});
}

this.setState({ oidcConfigs });
this.updateListeners();
})
.catch(() => {});
}

Expand Down

0 comments on commit 693803f

Please sign in to comment.