Package oauth2.thirdparty

Examples of oauth2.thirdparty.RestaurantReservationService


    if (accessToken == null) {
        return redirectToFailureHandler(NO_OAUTH_ACCESS_TOKEN);
    }
   
   
    Calendar c = null;
    try {
      String authHeader = manager.createAuthorizationHeader(accessToken);
          socialService.replaceHeader("Authorization", authHeader);
         
          c = socialService.get(Calendar.class);
    } catch (RuntimeException ex) {
        return redirectToFailureHandler(CALENDAR_ACCESS_PROBLEM);
    }
   
      CalendarEntry entry = c.getEntry(request.getHour());
    if (entry.getEventDescription() == null || entry.getEventDescription().trim().isEmpty()) {
      String address = restaurantService.post(new Form().set("name", request.getReserveName())
                               .set("phone", request.getContactPhone())
                               .set("hour", request.getHour()),
                                String.class);
View Full Code Here


          c = socialService.get(Calendar.class);
    } catch (RuntimeException ex) {
        return redirectToFailureHandler(CALENDAR_ACCESS_PROBLEM);
    }
   
      CalendarEntry entry = c.getEntry(request.getHour());
    if (entry.getEventDescription() == null || entry.getEventDescription().trim().isEmpty()) {
      String address = restaurantService.post(new Form().set("name", request.getReserveName())
                               .set("phone", request.getContactPhone())
                               .set("hour", request.getHour()),
                                String.class);
      if (address == null) {
View Full Code Here

   
    newClient.setApplicationDescription(appDesc);
    newClient.setApplicationLogoUri(logoURI.toString());
    newClient.setRedirectUris(Collections.singletonList(appRedirectURI));
    manager.registerClient(newClient);
    return new ConsumerRegistration(clientId, clientSecret);
  }
View Full Code Here

    String clientSecret = generateClientSecret();
 
    Client newClient = new Client(clientId, clientSecret, true, appName, appURI);
    newClient.setRedirectUris(Collections.singletonList(appRedirectURI));
    manager.registerClient(newClient);
    return new ConsumerRegistration(clientId, clientSecret);
  }
View Full Code Here

      }
     
      WebClient finalClient = createClient(locationHeader2.toString(),
          "barry@restaurant.com", "5678");
      finalClient.accept("application/xml");
      ReservationConfirmation confirm = finalClient.get(ReservationConfirmation.class);
     
      if (confirm != null) {
        updateAndGetUserCalendar(7, "Dinner at " + confirm.getAddress());
      } else {
        System.out.println("Reservation failed");
      }
    }
View Full Code Here

           
            Response response = socialService.form(new Form().set("hour", request.getHour())
                                   .set("description", "Table reserved at " + address));
            boolean calendarUpdated = response.getStatus() == 200 || response.getStatus() == 204;
     
      return Response.ok(new ReservationConfirmation(address, request.getHour(), calendarUpdated))
                     .build();
    } else {
        return redirectToFailureHandler(CALENDAR_BUSY);
    }
    }
View Full Code Here

    @Produces({"text/html", "application/xml;q=0.9" })
    public ReservationFailure handleReservationFailure(@QueryParam("code") String errorCode) {
        LOG.info("Handling the reservation failure");
       
        String message = ERROR_DESCRIPTIONS.get(errorCode);
        return new ReservationFailure(message);
    }
View Full Code Here

                               @FormParam("password") String password) {
    if (accounts.getAccount(name) != null) {
      throw new WebApplicationException(400);
    }
    accounts.setAccount(name, new UserAccount(name, password, alias));
    return new UserRegistration(name);
  }
View Full Code Here

    private Server oauthServer;
   
    public void start() throws Exception {

      UserAccounts accounts = new UserAccounts();
      OAuthManager manager = new OAuthManager();
      SocialApplication socialApp = new SocialApplication();
      socialApp.setAccounts(accounts);
      socialApp.setOAuthManager(manager);
      socialServer = startApplication(socialApp);
     
View Full Code Here

        userRegService.setAccounts(accounts);
       
        SecurityContextFilter scFilter = new SecurityContextFilter();
        scFilter.setAccounts(accounts);
       
        ThirdPartyAccessService thirdPartyAccessService = new ThirdPartyAccessService();
        thirdPartyAccessService.setAccounts(accounts);
       
        AuthorizationCodeGrantService authService = new AuthorizationCodeGrantService();
        authService.setDataProvider(manager);
               
        classes.add(socialService);
View Full Code Here

TOP

Related Classes of oauth2.thirdparty.RestaurantReservationService

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.