Skip to content

Commit 84f6983

Browse files
committed
修改OAuth2配置方式
1 parent 1749865 commit 84f6983

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

.eslintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ module.exports = {
44
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
55
page: true,
66
REACT_APP_ENV: true,
7+
OAUTH2_CLIENT_ID: true,
8+
OAUTH2_SERVER: true,
9+
OAUTH2_CALLBACK: true,
710
},
811
};

config/config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,9 @@ export default defineConfig({
182182
manifest: {
183183
basePath: '/',
184184
},
185+
define: {
186+
OAUTH2_CLIENT_ID: '1000',
187+
OAUTH2_SERVER: 'http://localhost:8080',
188+
OAUTH2_CALLBACK: 'http://localhost:8800/auth/callback',
189+
}
185190
});

config/nginx-default.conf

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ server {
1818
}
1919

2020
location /api/auth/ {
21-
proxy_pass http://192.168.1.111:8081/auth/;
21+
proxy_pass http://naas-admin-token-server:8081/auth/;
2222
proxy_set_header X-Forwarded-Proto $scheme;
2323
proxy_set_header X-Real-IP $remote_addr;
2424
}
2525

2626
location /api/accounts/ {
27-
proxy_pass http://192.168.1.111:8080/;
27+
proxy_pass http://naas:8080/;
2828
proxy_set_header X-Forwarded-Proto $scheme;
2929
proxy_set_header X-Real-IP $remote_addr;
3030
}
3131

3232
location /api/ {
33-
proxy_pass http://192.168.1.111:8080/api/v1/;
33+
proxy_pass http://naas:8080/api/v1/;
3434
proxy_set_header X-Forwarded-Proto $scheme;
3535
proxy_set_header X-Real-IP $remote_addr;
3636
}

src/layouts/SecurityLayout.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { connect, ConnectProps } from 'umi';
44
import { stringify } from 'querystring';
55
import { ConnectState } from '@/models/connect';
66
import { CurrentUser } from '@/models/user';
7-
import { OAUTH2_CALLBACK, OAUTH2_CLIENT_ID, OAUTH2_SERVER } from '@/utils/constants';
87

98
interface SecurityLayoutProps extends ConnectProps {
109
loading?: boolean;

src/pages/auth/callback/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { history } from 'umi';
33
import { Alert, Button } from 'antd';
44

55
import { authCode } from '@/services/auth';
6-
import { OAUTH2_CALLBACK, OAUTH2_SERVER, OAUTH2_CLIENT_ID } from '@/utils/constants';
76
import { setToken } from '@/utils/token';
87
import styles from './style.less';
98

src/services/auth.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import request from '@/utils/request';
2-
import { OAUTH2_CLIENT_ID } from '@/utils/constants';
32

43
export interface CodeParamsType {
54
code: string;

src/typings.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ declare let ga: Function;
3636
declare let ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: 'site' | undefined;
3737

3838
declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false;
39+
40+
declare let OAUTH2_CLIENT_ID;
41+
declare let OAUTH2_SERVER;
42+
declare let OAUTH2_CALLBACK;

src/utils/constants.ts

-9
This file was deleted.

0 commit comments

Comments
 (0)