Package pt.webdetails.browserid

Examples of pt.webdetails.browserid.BrowserIdResponse$ResponseFields


//    String assertionAudience = request.getParameter(getAudienceParameterName());
   
    if(browserIdAssertion != null) {
    
      BrowserIdVerifier verifier = new BrowserIdVerifier(getVerificationServiceUrl());
      BrowserIdResponse response = null;
     
      String audience  = request.getRequestURL().toString();
      try {
        URL url = new URL(audience);
        audience = url.getHost();
      } catch (MalformedURLException e) {
        throw new BrowserIdAuthenticationException("Malformed request URL", e);
      }
     
//      Assert.hasLength("Unable to determine hostname",audience);
//      if(!StringUtils.equals(audience, assertionAudience)){
//        logger.error("Server and client-side audience don't match");
//      }
     
      try {
        response = verifier.verify(browserIdAssertion, audience);
      } catch (HttpException e) {
        throw new BrowserIdAuthenticationException("Error calling verify service [" + verifier.getVerifyUrl() + "]", e);
      } catch (IOException e) {
        throw new BrowserIdAuthenticationException("Error calling verify service [" + verifier.getVerifyUrl() + "]", e);
      } catch (JSONException e){
        throw new BrowserIdAuthenticationException("Could not parse response from verify service [" + verifier.getVerifyUrl() + "]", e);
      }

      if(response != null){
        if(response.getStatus() == BrowserIdResponse.Status.OK){
          BrowserIdAuthenticationToken token = new BrowserIdAuthenticationToken(response, browserIdAssertion);
          //send to provider to get authorities
          return getAuthenticationManager().authenticate(token);
        }
        else {
          throw new BrowserIdAuthenticationException("BrowserID verification failed, reason: " + response.getReason());
        }
      }
      else throw new BrowserIdAuthenticationException("Verification yielded null response");
    }
    //may not be a BrowserID authentication
View Full Code Here


    Assert.isInstanceOf(BrowserIdAuthentication.class, authentication,
                        "Only " + BrowserIdAuthentication.class.getName() + " is supported.");

    BrowserIdAuthentication browserIdAuth = (BrowserIdAuthentication) authentication;
   
    BrowserIdResponse response = //browserIdAuth.getVerificationResponse() == null ?
                                 //verifyAuthentication(browserIdAuth):
                                 browserIdAuth.getVerificationResponse();
       
    if(response != null && response.getStatus() == BrowserIdResponse.Status.OK ){
      String identity = response.getEmail();
      //get authorities
      GrantedAuthority[] grantedAuthorities = getAuthoritiesService().getAuthoritiesForUser(identity);
      if(grantedAuthorities == null || grantedAuthorities.length == 0){
        throw new BrowserIdAuthenticationException("No authorities granted to " + identity);
      }
View Full Code Here

TOP

Related Classes of pt.webdetails.browserid.BrowserIdResponse$ResponseFields

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.