Commit d0d0e2ab authored by guozhipeng's avatar guozhipeng

登录

parent 04722f7e
...@@ -287,35 +287,14 @@ sap.ui.define( ...@@ -287,35 +287,14 @@ sap.ui.define(
// initDict(){}, // initDict(){},
getBaseUrl() { getBaseUrl() {
let that = this; let that = this;
if(location.host === 'localhost:8089'){
// that.getSessionStorage().put('baseUrlCache', '');
}
let baseUrlCache = this.getSessionStorage().get('baseUrlCache'); let baseUrlCache = this.getSessionStorage().get('baseUrlCache');
if (this.isEmpty(baseUrlCache)) { if (this.isEmpty(baseUrlCache)) {
jQuery.ajax(sap.ui.require.toUrl("sap/ui/demo/mock/config.json"), { var protocol = window.location.protocol;
dataType: "json", var hostname = window.location.hostname;
async: false, var port = window.location.port ? ':' + window.location.port : ''; // 如果端口号不是默认,则添加':'和端口号
success: function (oData) { baseUrlCache = protocol + '//' + hostname + port + "/";
baseUrlCache = oData.Config.baseUrl console.log("[baseUrlCache]", baseUrlCache);
let currentEnvironment = that.getSessionStorage().get('currentEnvironment')
if(currentEnvironment){
baseUrlCache = oData.Config[currentEnvironment]
}
if (!oData.Config.isServerConfig) {
let str = ""
if (oData.Config.port.trim()) {
str = ":" + oData.Config.port + "/"
}
baseUrlCache = window.location.protocol + '//' + window.location.hostname + (str ? str : '/')
}
that.getSessionStorage().put('baseUrlCache', baseUrlCache); that.getSessionStorage().put('baseUrlCache', baseUrlCache);
},
error: function () {
}
});
} }
return baseUrlCache; return baseUrlCache;
}, },
......
...@@ -123,19 +123,6 @@ sap.ui.define([ ...@@ -123,19 +123,6 @@ sap.ui.define([
// return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.windows.phone || sap.ui.Device.os.blackberry); // return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.windows.phone || sap.ui.Device.os.blackberry);
return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.blackberry); return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.blackberry);
}, },
//获取cookie
getCookie: function(name) {
let matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
},
//设置cookie
setCookie: function(name, value, expireHours) {
var cookieExp = new Date();
cookieExp.setHours(cookieExp.getHours() + expireHours);
document.cookie = name + "=" + encodeURIComponent(value) + "; path=/; expires=" + cookieExp.toUTCString();
},
// 登录 // 登录
onLogin: function(oEvent) { onLogin: function(oEvent) {
// this.getRouter().navTo("menu", {}, true); // this.getRouter().navTo("menu", {}, true);
...@@ -150,21 +137,17 @@ sap.ui.define([ ...@@ -150,21 +137,17 @@ sap.ui.define([
MessageBox.warning(this.i18n("Msg_input_username_password")); MessageBox.warning(this.i18n("Msg_input_username_password"));
return; return;
} }
console.log("JSESSIONID=", this.getCookie('JSESSIONID')); console.log("onLoginUrl=", that.baseUrl+"login/login");
let busyDialog = new sap.m.BusyDialog(); let busyDialog = new sap.m.BusyDialog();
busyDialog.open(); busyDialog.open();
jQuery.ajax({ jQuery.ajax({
method: "POST", method: "POST",
data: JSON.stringify(param), data: JSON.stringify(param),
// url: "/login",
url: that.baseUrl+"login/login", url: that.baseUrl+"login/login",
// url: "http://localhost:8080/login/login",
contentType: 'application/json', contentType: 'application/json',
authorization: 'Basic c2FiaW5lOnBhc3Nfc2FiaW5l',
dataType: 'json', dataType: 'json',
success: function(data){ success: function(data){
// console.log('data',data)
// 关闭进度条 // 关闭进度条
busyDialog.close(); busyDialog.close();
// if(data.flag){ // if(data.flag){
......
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
"baseUrl_pre": "https://lianchuangjie-pre.unibetter-ic.com/", "baseUrl_pre": "https://lianchuangjie-pre.unibetter-ic.com/",
"baseUrl_pro": "https://sap.unibetter-ic.com/", "baseUrl_pro": "https://sap.unibetter-ic.com/",
"isServerConfig":false, "isServerConfig":false,
"port": "8080" "port": ""
} }
} }
{ {
"welcomeFile": "app/index.html", "welcomeFile": "/main/webapp/index.html",
"routes": [ "routes": [
{ {
"source": "^/odata/(.*)", "source": "^/odata/(.*)",
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"destination": "srv-api" "destination": "srv-api"
}, },
{ {
"source": "^/app/(.*)", "source": "^/main/(.*)",
"target": "/$1", "target": "/$1",
"localDir": "./main", "localDir": "./main",
"cacheControl": "no-cache, no-store, must-revalidate" "cacheControl": "no-cache, no-store, must-revalidate"
......
...@@ -95,19 +95,19 @@ public class OperateAuthFilter implements Filter { ...@@ -95,19 +95,19 @@ public class OperateAuthFilter implements Filter {
Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();//权限的集合 Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();//权限的集合
Object credentials = authentication.getCredentials();//获取凭证 Object credentials = authentication.getCredentials();//获取凭证
Object details = authentication.getDetails();//获取详细信息 Object details = authentication.getDetails();//获取详细信息
org.springframework.security.core.userdetails.User principal = (org.springframework.security.core.userdetails.User) authentication.getPrincipal();//获取主体信息 org.springframework.security.core.userdetails.User principal = (org.springframework.security.core.userdetails.User)authentication.getPrincipal();//获取主体信息
//Collection<GrantedAuthority> authorities0 = principal.getAuthorities(); //Collection<GrantedAuthority> authorities0 = principal.getAuthorities();
boolean isAuthenticated = authentication.isAuthenticated();//判断是否已认证 boolean isAuthenticated = authentication.isAuthenticated();//判断是否已认证
log.info("用户名:{}", name); //log.info("用户名:{}", name);
log.info("返回一个包含授予权限的集合:{}", authorities);//Granted Authorities=[ROLE_ANONYMOUS] //log.info("返回一个包含授予权限的集合:{}", authorities);//Granted Authorities=[ROLE_ANONYMOUS]
log.info("获取凭证:{}", credentials);//登录密码 Credentials=[PROTECTED], //log.info("获取凭证:{}", credentials);//登录密码 Credentials=[PROTECTED],
log.info("获取详细信息:{}", details);//Details=WebAuthenticationDetails [RemoteIpAddress=127.0.0.1, SessionId=null], //log.info("获取详细信息:{}", details);//Details=WebAuthenticationDetails [RemoteIpAddress=127.0.0.1, SessionId=null],
log.info("判断是否已认证:{}", isAuthenticated);//Authenticated=true, //log.info("判断是否已认证:{}", isAuthenticated);//Authenticated=true,
log.info("获取主体信息:{}", principal);//登录账号 Principal=anonymousUser, //log.info("获取主体信息:{}", principal);//登录账号 Principal=anonymousUser,
//log.info("获取主体信息getPassword:{}", principal.get("password"));
//log.info("获取主体信息isEnabled:{}", principal.isEnabled());
log.info("获取主体信息getUsername:{}", principal.getUsername()); log.info("获取主体信息getUsername:{}", principal.getUsername());
log.info("获取主体信息getPassword:{}", principal.getPassword());
log.info("获取主体信息getAuthorities:{}", principal.getAuthorities()); log.info("获取主体信息getAuthorities:{}", principal.getAuthorities());
log.info("获取主体信息isEnabled:{}", principal.isEnabled());
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment