-
Notifications
You must be signed in to change notification settings - Fork 281
Add impersonate User feature #7988
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
Changes from 6 commits
5922fca
7211d85
f118356
97a138a
cfe669e
c0fe3f7
1b85128
2b3572f
82d4ff5
d329c55
15c7784
adfbf2b
05fd85e
10796e4
29c0973
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!-- | ||
~ Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. | ||
~ | ||
~ This software is the property of WSO2 LLC. and its suppliers, if any. | ||
~ Dissemination of any information or reproduction of any material contained | ||
~ herein in any form is strictly forbidden, unless permitted by WSO2 expressly. | ||
~ You may not alter or remove any copyright or other notice from copies of this content." | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Impersonate Iframe</title> | ||
mpmadhavig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</head> | ||
<body onload="authenticate()"> | ||
<script> | ||
var hash = window.location.hash; | ||
const params = new URLSearchParams(window.location.search); | ||
const userId = params.get("userId"); | ||
const code_challenge = params.get("codeChallenge"); | ||
const client_id = "Pfao0gjJ07be0gf29PzEcLFKmUIa"; | ||
mpmadhavig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const authorization_endpoint = sessionStorage.getItem("authorization_endpoint"); | ||
|
||
function authenticate() { | ||
|
||
const requestUrl = authorization_endpoint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are loading the spa-sdk from console/index.html. So this iframe too may have access to that. If it does, we can use the spa sdk methods to build the authorization URL, instead of chaining params manually |
||
+ "?client_id=" + client_id + | ||
"&redirect_uri=" + window.location.origin + window.location.pathname + | ||
"&state=sample_state&scope=internal_user_impersonate&response_type=id_token%20subject_token" + | ||
"&requested_subject=" + userId + | ||
"&nonce=2131236&code_challenge=" + code_challenge + "&code_challenge_method=S256"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's randomize the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PS: If you are using spa sdk, we wouldn't need to worry about this. |
||
|
||
if (hash === null || hash === "") { | ||
mpmadhavig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
window.location.href = requestUrl; | ||
} else { | ||
if (sessionStorage.getItem("impersonation_artifacts") === null) { | ||
sessionStorage.setItem("impersonation_artifacts", hash); | ||
mpmadhavig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
window.parent.postMessage("impersonation-authorize-request-complete", "*"); | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> | ||
mpmadhavig marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
import { AppState } from "@wso2is/admin.core.v1/store"; | ||
import { UserManagementConstants } from "@wso2is/admin.users.v1/constants"; | ||
import { RoleConstants } from "@wso2is/core/constants"; | ||
import { hasRequiredScopes, isFeatureEnabled } from "@wso2is/core/helpers"; | ||
Check failure on line 23 in features/admin.roles.v2/components/edit-role/edit-role.tsx
|
||
import { | ||
FeatureAccessConfigInterface, | ||
RolePropertyInterface, | ||
|
@@ -127,7 +127,8 @@ | |
render: () => ( | ||
<ResourceTab.Pane controlledSegmentation attached={ false }> | ||
<BasicRoleDetails | ||
isReadOnly={ isAdminRole || isEveryoneRole || isReadOnly || isSharedRole } | ||
isReadOnly={ isAdminRole || isEveryoneRole || isReadOnly || isSharedRole | ||
|| roleObject?.displayName == "impersonate-myaccount" } | ||
mpmadhavig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
role={ roleObject } | ||
onRoleUpdate={ onRoleUpdate } | ||
tabIndex={ 0 } | ||
|
@@ -140,7 +141,8 @@ | |
render: () => ( | ||
<ResourceTab.Pane controlledSegmentation attached={ false }> | ||
<UpdatedRolePermissionDetails | ||
isReadOnly={ isAdminRole || isReadOnly || isSharedRole } | ||
isReadOnly={ isAdminRole || isReadOnly || isSharedRole | ||
|| roleObject?.displayName == "impersonate-myaccount" } | ||
mpmadhavig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
role={ roleObject } | ||
onRoleUpdate={ onRoleUpdate } | ||
tabIndex={ 1 } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,13 @@ | |
*/ | ||
|
||
import { Show } from "@wso2is/access-control"; | ||
import { FeatureConfigInterface } from "@wso2is/admin.core.v1/models/config"; | ||
import { getEmptyPlaceholderIllustrations } from "@wso2is/admin.core.v1/configs/ui"; | ||
import { AppConstants } from "@wso2is/admin.core.v1/constants/app-constants"; | ||
import { history } from "@wso2is/admin.core.v1/helpers/history"; | ||
import { AppState } from "@wso2is/admin.core.v1/store/index"; | ||
import { RoleConstants as CommonRoleConstants } from "@wso2is/core/constants"; | ||
import { hasRequiredScopes, isFeatureEnabled } from "@wso2is/core/helpers"; | ||
Check failure on line 26 in features/admin.roles.v2/components/role-list.tsx
|
||
import { | ||
FeatureAccessConfigInterface, | ||
IdentifiableComponentInterface, | ||
|
@@ -318,7 +318,8 @@ | |
RoleConstants.FEATURE_DICTIONARY.get("ROLE_DELETE")) | ||
|| !hasRequiredScopes(userRolesFeatureConfig, | ||
userRolesFeatureConfig?.scopes?.delete, allowedScopes) | ||
|| isSharedRole; | ||
|| isSharedRole | ||
|| role?.displayName === "impersonate-myaccount"; | ||
}, | ||
icon: (): SemanticICONS => "trash alternate", | ||
onClick: (e: SyntheticEvent, role: RolesInterface): void => { | ||
|
Uh oh!
There was an error while loading. Please reload this page.