@@ -0,0 +1,1184 @@
+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.response.AuthenticateResponse;%0Aimport yushijinhun.authlibagent.web.YggdrasilPostServlet;%0Aimport static yushijinhun.authlibagent.commons.UUIDUtils.*;%0A%0A@WebServlet(%22/yggdrasil/refresh%22)%0Apublic class RefreshServlet 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 clientToken = toUUID(req.getString(%22clientToken%22));%0A%09%09UUID accessToken = toUUID(req.getString(%22accessToken%22));%0A%0A%09%09AuthenticateResponse auth;%0A%0A%09%09JSONObject newProfileReq = req.optJSONObject(%22selectedProfile%22);%0A%09%09if (newProfileReq == null) %7B%0A%09%09%09// refresh%0A%09%09%09auth = backend.refresh(accessToken, clientToken);%0A%09%09%7D else %7B%0A%09%09%09// select profile%0A%09%09%09UUID newProfile = toUUID(newProfileReq.getString(%22id%22));%0A%09%09%09auth = backend.selectProfile(accessToken, clientToken, newProfile);%0A%09%09%7D%0A%0A%09%09return serializer.serializeAuthenticateResponse(auth, clientToken);%0A%09%7D%0A%0A%7D%0A

add RefreshServlet