| | |
| | | throw new CASValidationException(CASErrorCode.INVALID_TICKET_SPEC, "Malformed service ticket", Response.Status.BAD_REQUEST); |
| | | } |
| | | |
| | | Boolean isreuse = ticket.startsWith(CASLoginProtocol.PROXY_GRANTING_TICKET_PREFIX); |
| | | boolean isReusable = ticket.startsWith(CASLoginProtocol.PROXY_GRANTING_TICKET_PREFIX); |
| | | |
| | | String[] parsed = DOT.split(ticket.substring(prefix.length()), 3); |
| | | if (parsed.length != 3) { |
| | |
| | | throw new CASValidationException(CASErrorCode.INVALID_TICKET_SPEC, "Invalid format of the code", Response.Status.BAD_REQUEST); |
| | | } |
| | | |
| | | String codeUUID = parsed[0]; |
| | | String userSessionId = parsed[1]; |
| | | String clientUUID = parsed[2]; |
| | | |
| | | event.detail(Details.CODE_ID, userSessionId); |
| | | event.session(userSessionId); |
| | | |
| | | // Parse UUID |
| | | String codeUUID; |
| | | try { |
| | | codeUUID = parsed[0]; |
| | | } catch (IllegalArgumentException re) { |
| | | event.error(Errors.INVALID_CODE); |
| | | throw new CASValidationException(CASErrorCode.INVALID_TICKET_SPEC, "Invalid format of the UUID in the code", Response.Status.BAD_REQUEST); |
| | | } |
| | | |
| | | // Retrieve UserSession |
| | | UserSessionModel userSession = new UserSessionCrossDCManager(session).getUserSessionWithClient(realm, userSessionId, clientUUID); |
| | |
| | | } |
| | | |
| | | SingleUseObjectProvider codeStore = session.singleUseObjects(); |
| | | Map<String, String> codeDataSerialized = isreuse? codeStore.get(prefix + codeUUID) : codeStore.remove(prefix + codeUUID); |
| | | Map<String, String> codeDataSerialized = isReusable ? codeStore.get(prefix + codeUUID) : codeStore.remove(prefix + codeUUID); |
| | | |
| | | // Either code not available |
| | | if (codeDataSerialized == null) { |