| | |
| | | import eu.bitwalker.useragentutils.UserAgent; |
| | | import eu.bitwalker.useragentutils.Version; |
| | | |
| | | /** |
| | | * @author Tanbin |
| | | * @date 2018-12-12 |
| | | */ |
| | | @Component("loginAction2") |
| | | public class LoginAction2 extends AbstractAction { |
| | | protected Logger logger = LoggerFactory.getLogger(getClass()); |
| | |
| | | protected CentralAuthenticationService centralAuthenticationService; |
| | | |
| | | protected ServicesManager servicesManager; |
| | | |
| | | @Override |
| | | protected Event doExecute(RequestContext requestContext) throws Exception { |
| | | final TicketGrantingTicket tgt; |
| | | final Map<String, HandlerResult> successes=new HashMap<>(); |
| | | final Map<String, HandlerResult> successes = new HashMap<>(5); |
| | | String username= requestContext.getFlowScope().get("username").toString(); |
| | | UsernamePasswordCredential credential=new UsernamePasswordCredential(username,""); |
| | | CredentialMetaData cmd= new BasicCredentialMetaData(credential); |
| | |
| | | Principal principal=p.createPrincipal(username); |
| | | HandlerResult hs= new DefaultHandlerResult("handler",cmd,principal,null); |
| | | successes.put("success", hs); |
| | | final Map<String, Object> authenticationAttributes = new HashMap<>(); |
| | | final Map<String, Object> authenticationAttributes = new HashMap<>(5); |
| | | AuthenticationBuilder d=DefaultAuthenticationBuilder.newInstance(); |
| | | |
| | | HttpServletRequest request = WebUtils.getHttpServletRequest(); |
| | |
| | | |
| | | final DefaultAuthenticationResult res = new DefaultAuthenticationResult(authentication, null); |
| | | |
| | | tgt = this.centralAuthenticationService.createTicketGrantingTicket(res);; |
| | | tgt = this.centralAuthenticationService.createTicketGrantingTicket(res); |
| | | ; |
| | | WebUtils.putTicketGrantingTicketInScopes(requestContext, tgt); |
| | | WebUtils.putAuthenticationResult(res, requestContext); |
| | | WebUtils.putAuthentication(tgt.getAuthentication(), requestContext); |
| | |
| | | return new Event(this,"success"); |
| | | } |
| | | |
| | | public void setServicesManager(ServicesManager servicesManager) { this.servicesManager = servicesManager; } |
| | | public void setServicesManager(ServicesManager servicesManager) { |
| | | this.servicesManager = servicesManager; |
| | | } |
| | | } |