admin-web 接入新的登陆接口
This commit is contained in:
parent
41514100e0
commit
d89e5bad98
@ -1,40 +1,10 @@
|
|||||||
// 开发环境,的代理配置
|
// 开发环境,的代理配置
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'/system-api/': {
|
'/management-api/': {
|
||||||
target: 'http://127.0.0.1:18083/',
|
target: 'http://127.0.0.1:18083/',
|
||||||
// target: 'http://180.167.213.26:18083/',
|
// target: 'http://180.167.213.26:18083/',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {},
|
pathRewrite: {},
|
||||||
},
|
},
|
||||||
'/product-api/': {
|
|
||||||
// target: 'http://180.167.213.26:18083/',
|
|
||||||
target: 'http://127.0.0.1:18081/',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {},
|
|
||||||
},
|
|
||||||
'/order-api/': {
|
|
||||||
// target: 'http://180.167.213.26:18084/',
|
|
||||||
target: 'http://127.0.0.1:18088/',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {},
|
|
||||||
},
|
|
||||||
'/promotion-api/': {
|
|
||||||
// target: 'http://180.167.213.26:18085/',
|
|
||||||
target: 'http://127.0.0.1:18085/',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {},
|
|
||||||
},
|
|
||||||
'/user-api/': {
|
|
||||||
// target: 'http://180.167.213.26:18085/',
|
|
||||||
target: 'http://127.0.0.1:18082/',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {},
|
|
||||||
},
|
|
||||||
'/pay-api/': {
|
|
||||||
// target: 'http://180.167.213.26:18085/',
|
|
||||||
target: 'http://127.0.0.1:18084/',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { routerRedux } from 'dva/router';
|
import { routerRedux } from 'dva/router';
|
||||||
import { stringify } from 'qs';
|
import { stringify } from 'qs';
|
||||||
import { getFakeCaptcha } from '@/services/api';
|
import { getFakeCaptcha } from '@/services/api';
|
||||||
import { oauth2UsernameAuthenticate } from '@/services/system';
|
import { passportLogin } from '@/services/system';
|
||||||
import { setAuthority } from '@/utils/authority';
|
import { setAuthority } from '@/utils/authority';
|
||||||
import { getPageQuery } from '@/utils/utils';
|
import { getPageQuery } from '@/utils/utils';
|
||||||
import { reloadAuthorized } from '@/utils/Authorized';
|
import { reloadAuthorized } from '@/utils/Authorized';
|
||||||
@ -16,7 +16,7 @@ export default {
|
|||||||
|
|
||||||
effects: {
|
effects: {
|
||||||
*login({ payload }, { call, put }) {
|
*login({ payload }, { call, put }) {
|
||||||
const response = yield call(oauth2UsernameAuthenticate, payload);
|
const response = yield call(passportLogin, payload);
|
||||||
yield put({
|
yield put({
|
||||||
type: 'changeLoginStatus',
|
type: 'changeLoginStatus',
|
||||||
payload: response,
|
payload: response,
|
||||||
@ -28,7 +28,7 @@ export default {
|
|||||||
if (response.code === 0) {
|
if (response.code === 0) {
|
||||||
|
|
||||||
// 保存 token 到 localStorage,发送请求的时候,会自动取 token 放到 header
|
// 保存 token 到 localStorage,发送请求的时候,会自动取 token 放到 header
|
||||||
setLoginToken(response.data.token.accessToken, response.data.token.refreshToken);
|
setLoginToken(response.data.authorization.accessToken, response.data.authorization.refreshToken);
|
||||||
// 此处直接设置为 admin、和 user 角色,因为暂时不做服务控制前段 角色
|
// 此处直接设置为 admin、和 user 角色,因为暂时不做服务控制前段 角色
|
||||||
setAuthority(['admin', 'user']);
|
setAuthority(['admin', 'user']);
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import {stringify} from '@/utils/request.qs';
|
import {stringify} from '@/utils/request.qs';
|
||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
|
|
||||||
// ========== OAuth2 模块 ==========
|
// ========== Passport 模块 ==========
|
||||||
|
|
||||||
export async function oauth2UsernameAuthenticate(params) {
|
export async function passportLogin(params) {
|
||||||
return request(`/system-api/admins/oauth2/username-authenticate?${stringify(params)}`, {
|
return request(`/management-api/passport/login?${stringify(params)}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: {},
|
body: {},
|
||||||
});
|
});
|
||||||
|
@ -15,4 +15,12 @@ public class DigestUtils {
|
|||||||
return BCrypt.hashpw(key, salt);
|
return BCrypt.hashpw(key, salt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 稍后移到单元测试
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String salt = genBcryptSalt();
|
||||||
|
String password = "buzhidao";
|
||||||
|
System.out.println(salt);
|
||||||
|
System.out.println(bcrypt(password, salt));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user