7.25 渗透测试 前端secret修复,修改刷新token接口和code换token接口

This commit is contained in:
jl-zhoujl2
2023-07-25 15:05:29 +08:00
parent ff4671994e
commit 71f53b3268
13 changed files with 29 additions and 52 deletions

View File

@ -7,8 +7,8 @@ module.exports = {
//商城2.0跳转地址
REACT_APP_MALL_V2_URL: false,
//各系统跳转参数
REACT_APP_CLIENT_KEY: true,
REACT_APP_CLIENT_SECRET: true,
// REACT_APP_CLIENT_KEY: true,
// REACT_APP_CLIENT_SECRET: true,
//密码加密参数
REACT_APP_PASSWORD_CIPHERMODE: true,
REACT_APP_PASSWORD_PUBLICKEY: true,

View File

@ -7,8 +7,8 @@ export default defineConfig({
REACT_APP_MALL_V2_URL:'http://111.198.162.67/zglt/index_hzf.jsp?id=dev',
//各系统跳转参数
REACT_APP_CLIENT_KEY : 'KgPEkttG',
REACT_APP_CLIENT_SECRET :'ae5bdb183c502355d2055b3de73300aa73cbfdf3',
// REACT_APP_CLIENT_KEY : 'KgPEkttG',
// REACT_APP_CLIENT_SECRET :'ae5bdb183c502355d2055b3de73300aa73cbfdf3',
//密码加密参数
REACT_APP_PASSWORD_CIPHERMODE:'1',

View File

@ -7,8 +7,8 @@ export default defineConfig({
REACT_APP_MALL_V2_URL: 'http://111.198.162.67/zglt/index_hzf.jsp?id=dev',
//各系统跳转参数
REACT_APP_CLIENT_KEY: 'KgPEkttG',
REACT_APP_CLIENT_SECRET: 'ae5bdb183c502355d2055b3de73300aa73cbfdf3',
// REACT_APP_CLIENT_KEY: 'KgPEkttG',
// REACT_APP_CLIENT_SECRET: 'ae5bdb183c502355d2055b3de73300aa73cbfdf3',
//密码加密参数
REACT_APP_PASSWORD_CIPHERMODE: '1',

View File

@ -7,8 +7,8 @@ export default defineConfig({
REACT_APP_MALL_V2_URL:'http://111.198.162.67/zglt/index_hzf.jsp?id=dev',
//各系统跳转参数
REACT_APP_CLIENT_KEY : 'KgPEkttG',
REACT_APP_CLIENT_SECRET :'ae5bdb183c502355d2055b3de73300aa73cbfdf3',
// REACT_APP_CLIENT_KEY : 'KgPEkttG',
// REACT_APP_CLIENT_SECRET :'ae5bdb183c502355d2055b3de73300aa73cbfdf3',
//密码加密参数
REACT_APP_PASSWORD_CIPHERMODE:'1',

View File

@ -7,8 +7,8 @@ export default defineConfig({
REACT_APP_MALL_V2_URL: 'http://111.198.162.67/zglt/index_hzf.jsp?id=dev',
//各系统跳转参数
REACT_APP_CLIENT_KEY: 'KgPEkttG',
REACT_APP_CLIENT_SECRET: 'ae5bdb183c502355d2055b3de73300aa73cbfdf3',
// REACT_APP_CLIENT_KEY: 'KgPEkttG',
// REACT_APP_CLIENT_SECRET: 'ae5bdb183c502355d2055b3de73300aa73cbfdf3',
//密码加密参数
REACT_APP_PASSWORD_CIPHERMODE: '1',

View File

@ -22,15 +22,15 @@ const Loading: React.FC<{}> = () => {
clientId: REACT_APP_CLIENT_KEY,
scope: getUserScope()
}
const params = {
grant_type: "refresh_token",
refresh_token: getUserRefreshToken(),
client_id: REACT_APP_CLIENT_KEY,
client_secret: REACT_APP_CLIENT_SECRET,
}
const header = {
clientId: REACT_APP_CLIENT_KEY,
}
// const params = {
// grant_type: "refresh_token",
// refresh_token: getUserRefreshToken(),
// client_id: REACT_APP_CLIENT_KEY,
// client_secret: REACT_APP_CLIENT_SECRET,
// }
// const header = {
// clientId: REACT_APP_CLIENT_KEY,
// }
if (userType == '0') {//联通用户
await cloudReloadToken('', headers)
await getUserData(token, url, extra, 1)
@ -138,11 +138,9 @@ const Loading: React.FC<{}> = () => {
//获取协议部分 http: https:
const protocol = window.location.protocol
const grant_type = 'authorization_code';
const client_id = REACT_APP_CLIENT_KEY;
const client_secret = REACT_APP_CLIENT_SECRET;
const redirect_uri = `${protocol}//${host}/redirect${e}`;
let token = '';
await getTokenByCode({ grant_type, client_id, client_secret, redirect_uri, code }).then(res => {
await getTokenByCode({ grant_type, redirect_uri, code }).then(res => {
if (res?.success == true) {
sessionStorage.setItem('Authorization', res?.data?.value)
token = 'Bearer ' + res?.data?.value;

View File

@ -18,7 +18,7 @@ export async function fgetUserMsg(params: any) {
* @returns
*/
export async function getTokenByCode(params: any) {
return request('/api/auth/oauth/token', {
return request('/api/core-service-ebtp-userinfo/v1/auth/oauth/token', {
method: 'POST',
params: params,
});

View File

@ -62,13 +62,8 @@ const Login: React.FC<LoginProps> = (props) => {
const params = {
grant_type: "refresh_token",
refresh_token: data?.refreshToken?.value,
client_id: REACT_APP_CLIENT_KEY,
client_secret: REACT_APP_CLIENT_SECRET,
}
const header = {
clientId: REACT_APP_CLIENT_KEY,
}
await refreshTokenApi(params, header).then(res => {
await refreshTokenApi(params).then(res => {
if (res?.success == true) {
sessionStorage.setItem('Authorization', res?.data?.value);
// sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);

View File

@ -63,13 +63,8 @@ const Login: React.FC<LoginProps> = (props) => {
const params = {
grant_type: "refresh_token",
refresh_token: data?.refreshToken?.value,
client_id: REACT_APP_CLIENT_KEY,
client_secret: REACT_APP_CLIENT_SECRET,
}
const header = {
clientId: REACT_APP_CLIENT_KEY,
}
await refreshTokenApi(params, header).then(res => {
await refreshTokenApi(params).then(res => {
if (res?.success == true) {
sessionStorage.setItem('Authorization', res?.data?.value);
// sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);

View File

@ -62,13 +62,8 @@ const Login: React.FC<LoginProps> = (props) => {
const params = {
grant_type: "refresh_token",
refresh_token: data?.refreshToken?.value,
client_id: REACT_APP_CLIENT_KEY,
client_secret: REACT_APP_CLIENT_SECRET,
}
const header = {
clientId: REACT_APP_CLIENT_KEY,
}
await refreshTokenApi(params, header).then(res => {
await refreshTokenApi(params).then(res => {
if (res?.success == true) {
sessionStorage.setItem('Authorization', res?.data?.value);
// sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);

View File

@ -228,13 +228,8 @@ const Index: React.FC<{}> = () => {
const params = {
grant_type: "refresh_token",
refresh_token: data?.refreshToken?.value,
client_id: REACT_APP_CLIENT_KEY,
client_secret: REACT_APP_CLIENT_SECRET,
}
const header = {
clientId: REACT_APP_CLIENT_KEY,
}
await refreshTokenApi(params, header).then(res => {
await refreshTokenApi(params).then(res => {
if (res?.success == true) {
sessionStorage.setItem('Authorization', res?.data?.value);
// sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);

View File

@ -95,12 +95,11 @@ export async function CloudfakeAccountLogin(params: LoginParamsType) {
* @param params
* @returns
*/
export async function refreshTokenApi(params: any, headers: any) {
return request('/api/auth/oauth/token', {
export async function refreshTokenApi(params: any) {
return request('/api/core-service-ebtp-userinfo/v1/auth/oauth/token', {
method: 'POST',
requestType: 'form',
data: params,
headers: headers
});
}

4
src/typings.d.ts vendored
View File

@ -43,9 +43,9 @@ declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false;
/**ENV-商城2.0跳转地址 */
declare const REACT_APP_MALL_V2_URL: string
/**ENV-系统跳转参数KEY */
declare const REACT_APP_CLIENT_KEY: string
// declare const REACT_APP_CLIENT_KEY: string
/**ENV-系统跳转参数SECRET */
declare const REACT_APP_CLIENT_SECRET: string
// declare const REACT_APP_CLIENT_SECRET: string
/**ENV-密码加密参数CIPHERMODE */
declare const REACT_APP_PASSWORD_CIPHERMODE: string
/**ENV-密码加密参数PUBLICKEY */