@@ -0,0 +1,1100 @@
+package yushijinhun.authlibagent.web.servlet;%0A%0Aimport java.util.UUID;%0Aimport javax.servlet.annotation.WebServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport org.json.JSONObject;%0Aimport yushijinhun.authlibagent.api.web.ForbiddenOperationException;%0Aimport yushijinhun.authlibagent.web.YggdrasilPostServlet;%0Aimport static yushijinhun.authlibagent.commons.UUIDUtils.toUUID;%0A%0A@WebServlet(%22/yggdrasil/validate%22)%0Apublic class ValidateServlet extends YggdrasilPostServlet %7B%0A%0A%09private static final long serialVersionUID = 1L;%0A%0A%09@Override%0A%09protected JSONObject process(JSONObject req, HttpServletRequest rawReq) throws Exception %7B%0A%09%09UUID accessToken = toUUID(req.getString(%22accessToken%22));%0A%09%09String clientTokenStr = req.optString(%22clientToken%22, null);%0A%09%09UUID clientToken = clientTokenStr == null ? null : toUUID(clientTokenStr);%0A%0A%09%09boolean valid;%0A%09%09if (clientToken == null) %7B%0A%09%09%09valid = backend.validate(accessToken);%0A%09%09%7D else %7B%0A%09%09%09valid = backend.validate(accessToken, clientToken);%0A%09%09%7D%0A%0A%09%09if (valid) %7B%0A%09%09%09return null;%0A%09%09%7D else %7B%0A%09%09%09throw new ForbiddenOperationException(%22Invalid token%22);%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

add ValidateServlet