From a666b5f9741ef9b21f547d3b2141752a0383c70c Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 20 九月 2022 17:07:38 +0800 Subject: [PATCH] 1、修改登录页面 2、修改阿里代码规范问题 --- src/java/org/apereo/cas/web/flow/GenerateServiceTicketAction.java | 35 +++++++++++++++++++++++------------ 1 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/java/org/apereo/cas/web/flow/GenerateServiceTicketAction.java b/src/java/org/apereo/cas/web/flow/GenerateServiceTicketAction.java index 7491ff6..a18b36b 100644 --- a/src/java/org/apereo/cas/web/flow/GenerateServiceTicketAction.java +++ b/src/java/org/apereo/cas/web/flow/GenerateServiceTicketAction.java @@ -33,6 +33,10 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; +/** + * @author Tanbin + * @date 2018-12-12 + */ public class GenerateServiceTicketAction extends AbstractAction { private CentralAuthenticationService centralAuthenticationService; @@ -42,8 +46,11 @@ private ServicesManager servicesManager; @Autowired - public TerraProperties properties; - + public TerraProperties properties; + + private static String mFalse="false"; + + @Override protected Event doExecute(RequestContext context) { WebApplicationService webApplicationService = WebUtils.getService(context); String ticketGrantingTicket = WebUtils.getTicketGrantingTicketId(context); @@ -52,7 +59,7 @@ //杩涜鍒ゆ柇,鍒ゆ柇service鏄彲浠ヨ璇ョ敤鎴疯闂� String url=properties.getAdmissionQueryUrl(); //String url="http://192.168.1.40:8081/api/sys/systeminfo/isAdmitSysByUserid"; - Map<String,Object> map =new HashMap<>(); + Map<String,Object> map =new HashMap<>(5); String rep = null; map.put("userid", authentication.getPrincipal().getId()); @@ -71,19 +78,21 @@ // TODO Auto-generated catch block e.printStackTrace(); } - if(rep==null||"false".equals(rep)){ + if(rep==null||mFalse.equals(rep)){ System.out.print(rep); return new Event(this,"error"); } - if (authentication == null) - throw new InvalidTicketException(new AuthenticationException("No authentication found for ticket " + ticketGrantingTicket), ticketGrantingTicket); + if (authentication == null) { + throw new InvalidTicketException(new AuthenticationException("No authentication found for ticket " + ticketGrantingTicket), ticketGrantingTicket); + } RegisteredService registeredService = this.servicesManager.findServiceBy(webApplicationService); WebUtils.putRegisteredService(context, registeredService); WebUtils.putService(context, webApplicationService); WebUtils.putUnauthorizedRedirectUrlIntoFlowScope(context, registeredService .getAccessStrategy().getUnauthorizedRedirectUrl()); - if (WebUtils.getWarningCookie(context)) - return result("warn"); + if (WebUtils.getWarningCookie(context)) { + return result("warn"); + } Credential credential = WebUtils.getCredential(context); AuthenticationResultBuilder builder = this.authenticationSystemSupport.establishAuthenticationContextFromInitial(authentication, credential); AuthenticationResult authenticationResult = builder.build(webApplicationService); @@ -91,10 +100,12 @@ WebUtils.putServiceTicketInRequestScope(context, serviceTicketId); return success(); } catch (AbstractTicketException e) { - if (e instanceof InvalidTicketException) - this.centralAuthenticationService.destroyTicketGrantingTicket(ticketGrantingTicket); - if (isGatewayPresent(context)) - return result("gateway"); + if (e instanceof InvalidTicketException) { + this.centralAuthenticationService.destroyTicketGrantingTicket(ticketGrantingTicket); + } + if (isGatewayPresent(context)) { + return result("gateway"); + } return newEvent("authenticationFailure", e); } } -- Gitblit v1.9.3