Skip to content

Commit

Permalink
✨ Introducing new features. 适配 pig 3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lbw committed Jun 16, 2022
1 parent 983a77b commit 13ee1f9
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 96 deletions.
2 changes: 1 addition & 1 deletion ruoyi-admin/src/main/resources/application-druid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/ruoyi-vue-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: root
# 从库数据源
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public Authentication authenticate(Authentication authentication) throws Authent

String body = getAccessToken(code);

String username = JSONObject.parseObject(body).getJSONObject("user_info").getString("username");
String accessToken = JSONObject.parseObject(body).getString("access_token");

String username = JSONObject.parseObject(getSsoUser(accessToken)).getJSONObject("user_info").getString("username");
// 根据code 换username
UserDetails userDetails = userDetailsService.loadUserByUsername(username);

Expand All @@ -48,6 +50,7 @@ public Authentication authenticate(Authentication authentication) throws Authent
return authenticationResult;
}


@Override
public boolean supports(Class<?> authentication) {
// 判断 authentication 是不是 SsoCodeAuthenticationToken 的子类或子接口
Expand All @@ -65,19 +68,20 @@ public void setUserDetailsService(UserDetailsService userDetailsService) {
public String getAccessToken(String code) {
HttpHeaders headers = buildRequestHeader();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);

try {
Environment environment = SpringUtils.getBean(Environment.class);
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.add("grant_type", "authorization_code");
map.add("scope", "server");
map.add("scope", environment.getProperty("sso"));
map.add("code", code);

Environment environment = SpringUtils.getBean(Environment.class);
String callback = environment.getProperty("sso.callback-url");
String auth = environment.getProperty("sso.auth-server");
map.add("redirect_uri", callback);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);

ResponseEntity<String> response = new RestTemplate().postForEntity(auth + "/oauth/token", request, String.class);
ResponseEntity<String> response = new RestTemplate().postForEntity(auth + "/oauth2/token", request, String.class);
return response.getBody();
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
Expand All @@ -97,4 +101,13 @@ private HttpHeaders buildRequestHeader() {
return headers;
}

private String getSsoUser(String accessToken) {
Environment environment = SpringUtils.getBean(Environment.class);
String auth = environment.getProperty("sso.auth-server");
ResponseEntity<String> response = new RestTemplate().getForEntity(auth + "/token/check_token?token="+ accessToken, String.class);
return response.getBody();

}


}
180 changes: 90 additions & 90 deletions ruoyi-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
{
"name": "ruoyi",
"version": "3.8.1",
"description": "若依管理系统",
"author": "若依",
"license": "MIT",
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
]
},
"keywords": [
"vue",
"admin",
"dashboard",
"element-ui",
"boilerplate",
"admin-template",
"management-system"
],
"repository": {
"type": "git",
"url": "https://gitee.com/y_project/RuoYi-Vue.git"
},
"dependencies": {
"@riophae/vue-treeselect": "0.4.0",
"axios": "0.24.0",
"clipboard": "2.0.8",
"core-js": "3.19.1",
"echarts": "4.9.0",
"element-ui": "2.15.6",
"file-saver": "2.0.5",
"fuse.js": "6.4.3",
"highlight.js": "9.18.5",
"js-beautify": "1.13.0",
"js-cookie": "3.0.1",
"jsencrypt": "3.2.1",
"nprogress": "0.2.0",
"quill": "1.3.7",
"screenfull": "5.0.2",
"sortablejs": "1.10.2",
"vue": "2.6.12",
"vue-count-to": "1.0.13",
"vue-cropper": "0.5.5",
"vue-meta": "2.4.0",
"vue-router": "3.4.9",
"vuedraggable": "2.24.3",
"vuex": "3.6.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.6",
"@vue/cli-plugin-eslint": "4.4.6",
"@vue/cli-service": "4.4.6",
"babel-eslint": "10.1.0",
"babel-plugin-dynamic-import-node": "2.3.3",
"chalk": "4.1.0",
"compression-webpack-plugin": "5.0.2",
"connect": "3.6.6",
"eslint": "7.15.0",
"eslint-plugin-vue": "7.2.0",
"lint-staged": "10.5.3",
"runjs": "4.4.2",
"sass": "1.32.13",
"sass-loader": "10.1.1",
"script-ext-html-webpack-plugin": "2.1.5",
"svg-sprite-loader": "5.1.1",
"vue-template-compiler": "2.6.12"
},
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
{
"name": "ruoyi",
"version": "3.8.1",
"description": "若依管理系统",
"author": "若依",
"license": "MIT",
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
"git add"
]
},
"keywords": [
"vue",
"admin",
"dashboard",
"element-ui",
"boilerplate",
"admin-template",
"management-system"
],
"repository": {
"type": "git",
"url": "https://gitee.com/y_project/RuoYi-Vue.git"
},
"dependencies": {
"@riophae/vue-treeselect": "0.4.0",
"axios": "0.24.0",
"clipboard": "2.0.8",
"core-js": "^3.23.1",
"echarts": "4.9.0",
"element-ui": "2.15.6",
"file-saver": "2.0.5",
"fuse.js": "6.4.3",
"highlight.js": "9.18.5",
"js-beautify": "1.13.0",
"js-cookie": "3.0.1",
"jsencrypt": "3.2.1",
"nprogress": "0.2.0",
"quill": "1.3.7",
"screenfull": "5.0.2",
"sortablejs": "1.10.2",
"vue": "2.6.12",
"vue-count-to": "1.0.13",
"vue-cropper": "0.5.5",
"vue-meta": "2.4.0",
"vue-router": "3.4.9",
"vuedraggable": "2.24.3",
"vuex": "3.6.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.4.6",
"@vue/cli-plugin-eslint": "4.4.6",
"@vue/cli-service": "4.4.6",
"babel-eslint": "10.1.0",
"babel-plugin-dynamic-import-node": "2.3.3",
"chalk": "4.1.0",
"compression-webpack-plugin": "5.0.2",
"connect": "3.6.6",
"eslint": "7.15.0",
"eslint-plugin-vue": "7.2.0",
"lint-staged": "10.5.3",
"runjs": "4.4.2",
"sass": "1.32.13",
"sass-loader": "10.1.1",
"script-ext-html-webpack-plugin": "2.1.5",
"svg-sprite-loader": "5.1.1",
"vue-template-compiler": "2.6.12"
},
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
2 changes: 1 addition & 1 deletion ruoyi-ui/src/views/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default {
};
},
handleSSOLogin(){
window.location.href = "http://127.0.0.1:3000/oauth/authorize?client_id=ruoyi&response_type=code&redirect_uri=http://127.0.0.1:1024/sso"
window.location.href = "http://127.0.0.1:3000/oauth2/authorize?client_id=ruoyi&response_type=code&scope=server&redirect_uri=http://127.0.0.1:1024/sso"
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
Expand Down

0 comments on commit 13ee1f9

Please sign in to comment.