@Override public String getObject() { return SyncopeConsoleSession.get().getDomain(); }
@Override public boolean authenticate(final String username, final String password) { boolean authenticated = false; try { client = clientFactory.setDomain(getDomain()).create(username, password); refreshAuth(username); authenticated = true; } catch (Exception e) { LOG.error("Authentication failed", e); } return authenticated; }
public boolean authenticate(final String jwt) { boolean authenticated = false; try { client = clientFactory.setDomain(getDomain()).create(jwt); refreshAuth(null); authenticated = true; } catch (Exception e) { LOG.error("Authentication failed", e); } if (authenticated) { bind(); } signIn(authenticated); return authenticated; }
protected static <E extends JAXRSService, T> T getObject( final E service, final URI location, final Class<T> resultClass) { WebClient webClient = WebClient.fromClient(WebClient.client(service)); webClient.accept(SyncopeConsoleSession.get().getMediaType()).to(location.toASCIIString(), false); return webClient. header(RESTHeaders.DOMAIN, SyncopeConsoleSession.get().getDomain()). header(HttpHeaders.AUTHORIZATION, "Bearer " + SyncopeConsoleSession.get().getJWT()). get(resultClass); }
@Override public void onClick() { try { HttpResourceStream stream = new HttpResourceStream(new ConfRestClient().dbExport()); ResourceStreamRequestHandler rsrh = new ResourceStreamRequestHandler(stream); rsrh.setFileName(stream.getFilename() == null ? SyncopeConsoleSession.get().getDomain() + "Content.xml" : stream.getFilename()); rsrh.setContentDisposition(ContentDisposition.ATTACHMENT); rsrh.setCacheDuration(Duration.NONE); getRequestCycle().scheduleRequestHandlerAfterCurrent(rsrh); } catch (Exception e) { SyncopeConsoleSession.get().error(getString(Constants.ERROR) + ": " + e.getMessage()); } } };
body.add(new Label("domain", SyncopeConsoleSession.get().getDomain()));