Package org.openrdf.http.protocol.cas

Examples of org.openrdf.http.protocol.cas.ServiceResponse


      if (status == HttpStatus.SC_OK) {
        // Do not use raw stream since that will ignore the response's
        // character encoding
        String casResponseStr = proxyMethod.getResponseBodyAsString();
        ServiceResponse casResponse = ServiceResponseParser.parse(casResponseStr);
        if (casResponse instanceof ProxySuccess) {
          return ((ProxySuccess)casResponse).getProxyTicket();
        }
        else if (casResponse instanceof ProxyFailure) {
          ProxyFailure pf = (ProxyFailure)casResponse;
View Full Code Here


    validationURL.addQueryParameter("pgtUrl", getServiceURL(request));

    ClientResource serviceValidate = new ClientResource(validationURL);
    try {
      Representation validationResult = serviceValidate.get();
      ServiceResponse serviceResponse = ServiceResponseParser.parse(validationResult.getStream());

      if (serviceResponse instanceof AuthSuccess) {
        AuthSuccess authSuccess = (AuthSuccess)serviceResponse;
        request.getClientInfo().setUser(new User(authSuccess.getUser()));
        logger.debug("Validated CAS-ticket for user '{}'", authSuccess.getUser());

        if (authSuccess.getProxyGrantingTicket() != null) {
          String pgtId = pgtIouMap.remove(authSuccess.getProxyGrantingTicket());
          if (pgtId != null) {
            ProxyGrantingTicketRegistry.storeProxyGrantingTicket(pgtId);
          }
          else {
            logger.warn("pgtIou mapping missing for validated user '{}'", authSuccess.getUser());
          }
        }

        return true;
      }
      else if (serviceResponse instanceof AuthFailure) {
        AuthFailure authFailure = (AuthFailure)serviceResponse;
        response.setStatus(Status.CLIENT_ERROR_UNAUTHORIZED, authFailure.getMessage());
      }
      else {
        logger.warn("Unexpected response from CAS server ({}): {}", serviceResponse.getClass(),
            serviceResponse);
        response.setStatus(Status.SERVER_ERROR_INTERNAL, "CAS server communication problem");
      }
    }
    catch (ResourceException e) {
View Full Code Here

TOP

Related Classes of org.openrdf.http.protocol.cas.ServiceResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.