@Override public void redirect(final Status status, final String location) throws Throwable { rsp.redirect(status, location); }
@Override public void redirect(final String location) throws Throwable { rsp.redirect(location); }
redirect(Status.FOUND, location);
@SuppressWarnings("unchecked") @Override public void handle(final Request req, final Response rsp) throws Throwable { // DON'T create a session for JWT/param/header auth (a.k.a stateless) Optional<Session> ifSession = req.ifSession(); if (ifSession.isPresent()) { Session session = ifSession.get(); Optional<String> profileId = session.unset(Auth.ID).toOptional(); if (profileId.isPresent()) { Optional<CommonProfile> profile = req.require(AuthStore.class).unset(profileId.get()); log.debug("logout {}", profile); session.destroy(); } } else { log.debug("nothing to logout from session"); } String redirectTo = req.<String> ifGet("auth.logout.redirectTo").orElse(this.redirectTo); rsp.redirect(redirectTo); }
@Override public void handle(final Request req, final Response rsp) throws Throwable { String path = req.path(); URL resource = resolve(req, path); if (resource != null) { String localpath = resource.getPath(); int jarEntry = localpath.indexOf("!/"); if (jarEntry > 0) { localpath = localpath.substring(jarEntry + 2); } URLAsset asset = new URLAsset(resource, path, MediaType.byPath(localpath).orElse(MediaType.octetstream)); if (asset.exists()) { // cdn? if (cdn != null) { String absUrl = cdn + path; rsp.redirect(absUrl); rsp.end(); } else { doHandle(req, rsp, asset); } } } else if (statusCode > 0) { throw new Err(statusCode); } }
}); log.debug("redirecting to: {}", requestedUrl); rsp.redirect(requestedUrl); } catch (final HttpAction ex) { new AuthResponse(rsp).handle(client, ex);
@Override public void redirect(final String location) throws Throwable { rsp.redirect(location); }
@Override public void redirect(final Status status, final String location) throws Throwable { rsp.redirect(status, location); }
redirect(Status.FOUND, location);
@SuppressWarnings("unchecked") @Override public void handle(final Request req, final Response rsp) throws Throwable { // DON'T create a session for JWT/param/header auth (a.k.a stateless) Optional<Session> ifSession = req.ifSession(); if (ifSession.isPresent()) { Session session = ifSession.get(); Optional<String> profileId = session.unset(Auth.ID).toOptional(); if (profileId.isPresent()) { Optional<CommonProfile> profile = req.require(AuthStore.class).unset(profileId.get()); log.debug("logout {}", profile); session.destroy(); } } else { log.debug("nothing to logout from session"); } String redirectTo = req.<String> ifGet("auth.logout.redirectTo").orElse(this.redirectTo); rsp.redirect(redirectTo); }
@Override public void handle(final Request req, final Response rsp) throws Throwable { String path = req.path(); URL resource = resolve(req, path); if (resource != null) { String localpath = resource.getPath(); int jarEntry = localpath.indexOf("!/"); if (jarEntry > 0) { localpath = localpath.substring(jarEntry + 2); } URLAsset asset = new URLAsset(resource, path, MediaType.byPath(localpath).orElse(MediaType.octetstream)); if (asset.exists()) { // cdn? if (cdn != null) { String absUrl = cdn + path; rsp.redirect(absUrl); rsp.end(); } else { doHandle(req, rsp, asset); } } } else if (statusCode > 0) { throw new Err(statusCode); } }
}); log.debug("redirecting to: {}", requestedUrl); rsp.redirect(requestedUrl); } catch (final HttpAction ex) { new AuthResponse(rsp).handle(client, ex);