-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7350 from pavinduLakshan/push_auth_support_myaccount
- Loading branch information
Showing
27 changed files
with
1,406 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@wso2is/myaccount": minor | ||
"@wso2is/theme": patch | ||
"@wso2is/i18n": patch | ||
--- | ||
|
||
Introduce push authenticator configuration support in my account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { AsgardeoSPAClient, HttpClientInstance, HttpRequestConfig } from "@asgardeo/auth-react"; | ||
import { AxiosError, AxiosResponse } from "axios"; | ||
import { HttpMethods } from "../models"; | ||
import { store } from "../store"; | ||
|
||
/** | ||
* Get an axios instance. | ||
*/ | ||
const httpClient: HttpClientInstance = AsgardeoSPAClient.getInstance() | ||
.httpRequest.bind(AsgardeoSPAClient.getInstance()); | ||
|
||
/** | ||
* Generate push authenticator QR code URL for the authenticated user | ||
*/ | ||
export const initPushAuthenticatorQRCode = (): Promise<any> => { | ||
const requestConfig: HttpRequestConfig = { | ||
headers: { | ||
"Content-Type": "application/json" | ||
}, | ||
method: HttpMethods.GET, | ||
url: store.getState().config.endpoints.push + "/discovery-data" | ||
}; | ||
|
||
return httpClient(requestConfig) | ||
.then((response: AxiosResponse) => { | ||
if (response.status !== 200) { | ||
return Promise.reject(`An error occurred. The server returned ${response.status}`); | ||
} | ||
|
||
return Promise.resolve(response); | ||
}) | ||
.catch((error: AxiosError) => { | ||
return Promise.reject(error); | ||
}); | ||
}; | ||
|
||
export const getPushEnabledDevices = () => { | ||
const requestConfig: HttpRequestConfig = { | ||
headers: { | ||
"Content-Type": "application/json" | ||
}, | ||
method: HttpMethods.GET, | ||
url: store.getState().config.endpoints.push + "/devices" | ||
}; | ||
|
||
return httpClient(requestConfig) | ||
.then((response: AxiosResponse) => { | ||
if (response.status !== 200) { | ||
return Promise.reject(`An error occurred. The server returned ${response.status}`); | ||
} | ||
|
||
return Promise.resolve(response); | ||
}) | ||
.catch((error: AxiosError) => { | ||
return Promise.reject(error); | ||
}); | ||
}; | ||
|
||
export const deletePushAuthRegisteredDevice = (deviceId: string) => { | ||
const requestConfig: HttpRequestConfig = { | ||
headers: { | ||
"Content-Type": "application/json" | ||
}, | ||
method: HttpMethods.DELETE, | ||
params: { | ||
|
||
}, | ||
url: store.getState().config.endpoints.push + "/devices/" + deviceId | ||
}; | ||
|
||
return httpClient(requestConfig) | ||
.then((response: AxiosResponse) => { | ||
if (response.status !== 204) { | ||
return Promise.reject(`An error occurred. The server returned ${response.status}`); | ||
} | ||
|
||
return Promise.resolve(response); | ||
}) | ||
.catch((error: AxiosError) => { | ||
return Promise.reject(error); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...account/src/components/multi-factor-authentication/authenticators/push-authenticator.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
.push-authenticator { | ||
.ui.grid > .row.push-auth-registered-device-list { | ||
padding-top: 0; | ||
} | ||
|
||
.oxygen-list { | ||
padding: 0; | ||
} | ||
|
||
.device-icon { | ||
margin-left: -6px !important; | ||
margin-right: 8px !important; | ||
} | ||
|
||
.list-icon { | ||
cursor: pointer; | ||
} | ||
} |
Oops, something went wrong.