mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 20:50:14 +08:00
OnlineTicket
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package org.maxkey.authz.endpoint;
|
||||
|
||||
import org.maxkey.authn.online.OnlineTicket;
|
||||
import org.maxkey.authn.online.OnlineTicketServices;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value={"/onlineticket"})
|
||||
public class OnlineTicketEndpoint {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("onlineTicketServices")
|
||||
protected OnlineTicketServices onlineTicketServices;
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value="/validate")
|
||||
public OnlineTicket ticketValidate(
|
||||
@RequestParam(value ="ticket",required = true) String ticket) {
|
||||
OnlineTicket onlineTicket = onlineTicketServices.get(ticket);
|
||||
return onlineTicket;
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class CasAuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
|
||||
}
|
||||
|
||||
if(casDetails.getLogoutType()==LogoutType.BACK_CHANNEL) {
|
||||
String onlineTicketId = ((SigninPrincipal)WebContext.getAuthentication().getPrincipal()).getOnlineTicket();
|
||||
String onlineTicketId = ((SigninPrincipal)WebContext.getAuthentication().getPrincipal()).getOnlineTicket().getTicketId();
|
||||
OnlineTicket onlineTicket = onlineTicketServices.get(onlineTicketId);
|
||||
//set cas ticket as OnlineTicketId
|
||||
casDetails.setOnlineTicket(ticket);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class CasDefaultAdapter extends AbstractAuthorizeAdapter {
|
||||
serviceResponseBuilder.setAttribute("departmentId", userInfo.getDepartmentId());
|
||||
serviceResponseBuilder.setAttribute("workRegion",base64Attr(userInfo.getWorkRegion()));
|
||||
|
||||
serviceResponseBuilder.setAttribute(WebConstants.ONLINE_TICKET_NAME,authentication.getOnlineTicket());
|
||||
serviceResponseBuilder.setAttribute(WebConstants.ONLINE_TICKET_NAME,authentication.getOnlineTicket().getTicketId());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class OAuthDefaultUserInfoAdapter extends AbstractAuthorizeAdapter {
|
||||
beanMap.put("title", userInfo.getJobTitle());
|
||||
beanMap.put("state", userInfo.getWorkRegion());
|
||||
beanMap.put("gender", userInfo.getGender());
|
||||
beanMap.put(WebConstants.ONLINE_TICKET_NAME, authentication.getOnlineTicket());
|
||||
beanMap.put(WebConstants.ONLINE_TICKET_NAME, authentication.getOnlineTicket().getTicketId());
|
||||
|
||||
String info= JsonUtils.object2Json(beanMap);
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ public class UserInfoEndpoint {
|
||||
SigninPrincipal authentication = (SigninPrincipal)oAuth2Authentication.getUserAuthentication().getPrincipal();
|
||||
|
||||
jwtClaimsSetBuilder.claim("sub", userInfo.getId());
|
||||
jwtClaimsSetBuilder.claim(WebConstants.ONLINE_TICKET_NAME, authentication.getOnlineTicket());
|
||||
jwtClaimsSetBuilder.claim(WebConstants.ONLINE_TICKET_NAME, authentication.getOnlineTicket().getTicketId());
|
||||
|
||||
if(scopes.contains("profile")){
|
||||
jwtClaimsSetBuilder.claim("name", userInfo.getUsername());
|
||||
|
||||
@@ -73,7 +73,7 @@ public class AssertionEndpoint {
|
||||
logger.debug("AuthnRequestInfo: {}", authnRequestInfo);
|
||||
|
||||
HashMap <String,String>attributeMap=new HashMap<String,String>();
|
||||
attributeMap.put(WebConstants.ONLINE_TICKET_NAME, ((SigninPrincipal)WebContext.getAuthentication().getPrincipal()).getOnlineTicket());
|
||||
attributeMap.put(WebConstants.ONLINE_TICKET_NAME, ((SigninPrincipal)WebContext.getAuthentication().getPrincipal()).getOnlineTicket().getTicketId());
|
||||
|
||||
//saml20Details
|
||||
Response authResponse = authnResponseGenerator.generateAuthnResponse(
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TokenBasedDefaultAdapter extends AbstractAuthorizeAdapter {
|
||||
}
|
||||
|
||||
beanMap.put("displayName", userInfo.getDisplayName());
|
||||
beanMap.put(WebConstants.ONLINE_TICKET_NAME, authentication.getOnlineTicket());
|
||||
beanMap.put(WebConstants.ONLINE_TICKET_NAME, authentication.getOnlineTicket().getTicketId());
|
||||
|
||||
/*
|
||||
* use UTC date time format
|
||||
|
||||
Reference in New Issue
Block a user