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

ui/oidc: Add 'groups' scope when requesting an id_token from Dex #2529

Merged
merged 2 commits into from
May 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions ui/src/ducks/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ const defaultState = {
client_id: 'metalk8s-ui',
redirect_uri: 'http://localhost:3000/callback',
response_type: 'id_token',
scope:
'openid profile email offline_access audience:server:client_id:oidc-auth-client',
scope: [
'openid',
'profile',
'email',
'groups',
'offline_access', // For refresh tokens, not sure if that's useful
'audience:server:client_id:oidc-auth-client', // A token for apiserver
].join(' '),
authority: '',
loadUserInfo: false,
post_logout_redirect_uri: '/',
Expand Down Expand Up @@ -130,8 +136,8 @@ export function setThemesAction(themes) {
}

// Selectors
export const languageSelector = state => state.config.language;
export const apiConfigSelector = state => state.config.api;
export const languageSelector = (state) => state.config.language;
export const apiConfigSelector = (state) => state.config.api;

// Sagas
export function* fetchTheme() {
Expand Down Expand Up @@ -163,17 +169,17 @@ export function* fetchConfig() {
}),
);
const userManagerConfig = yield select(
state => state.config.userManagerConfig,
(state) => state.config.userManagerConfig,
);
yield put(setUserManagerAction(createUserManager(userManagerConfig)));
const userManager = yield select(state => state.config.userManager);
const userManager = yield select((state) => state.config.userManager);
yield call(loadUser, store, userManager);
yield put(setUserLoadedAction(true));
}
}

export function* updateApiServerConfig({ payload }) {
const api = yield select(state => state.config.api);
const api = yield select((state) => state.config.api);
if (api) {
yield call(
ApiK8s.updateApiServerConfig,
Expand Down Expand Up @@ -207,7 +213,7 @@ export function* updateLanguage(action) {
}

export function* logout() {
const userManager = yield select(state => state.config.userManager);
const userManager = yield select((state) => state.config.userManager);
if (userManager) {
userManager.removeUser(); // removes the user data from sessionStorage
}
Expand Down