public TokenAwareServer(ServiceClient serviceClient, String wellKnown) { super(serviceClient.host()); this.serviceClient = serviceClient; this.wellKnown = wellKnown; }
public PAServer2(ServiceClient serviceClient) { super(serviceClient.host()); this.serviceClient = serviceClient; }
public AGServer2(ServiceClient serviceClient) { super(serviceClient.host()); this.serviceClient = serviceClient; }
public UIServer2(ServiceClient serviceClient) { super(serviceClient.host()); this.serviceClient = serviceClient; }
public String getRawResponse(Map m) { return getRawResponse(convertToStringRequest(host().toString(), m)); }
@Override public void doIt() throws Exception { HashMap<String, String> map = new HashMap<>(); map.put(AbstractServlet.PING_PARAMETER, ""); info("Making initial request to service at " + serviceClient.host()); try { // Quick comment: In the service client, a response with HTML status code of 204 (status=ok, no body) is // processed and if correct, returns a raw response of length zero. If another code occurs and there is // no body, then an exception is raised. This is why the check below is the right one for the current case. String response = serviceClient.getRawResponse(map); if (response.length() == 0) { // then all is ok. Maybe do some logging info("ping ok"); } else { // moar logging warn("Ping failed to server " + serviceClient.host() + ". This ping works against servers that are version 3.0 or higher."); System.exit(1); } } catch (Throwable t) { error("ping failed to server " + serviceClient.host(), t); System.exit(1); } // From here on down is the older version for servers that do not support the ping command. }
@Override public DelegationResponse processDelegationRequest(DelegationRequest delegationRequest) { DelegationResponse delResp = new DelegationResponse(null); Map<String,String> m = delegationRequest.getParameters(); m.put(OA2Constants.CLIENT_ID, delegationRequest.getClient().getIdentifierString()); m.put(OA2Constants.REDIRECT_URI, delegationRequest.getParameters().get(OA2Constants.REDIRECT_URI)); URI authZUri = ((AGServer2)getAgServer()).getServiceClient().host(); URI redirectURI = URI.create(ServiceClient.convertToStringRequest(authZUri.toString(), m)); delResp.setParameters(m); //send them all back. delResp.setRedirectUri(redirectURI); return delResp; }