Package org.cedj.geekseek.domain.user.model

Examples of org.cedj.geekseek.domain.user.model.User


                            containsString("DELETE"),
                            containsString("PATCH"))).
                when().
                    options(testURL.toExternalForm());
            }
        }).inspect(new SetupAuth(new User("testuser")));
    }
View Full Code Here


                    then().
                        statusCode(Status.OK.getStatusCode()).
                when().
                    options(testURL.toExternalForm());
            }
        }).inspect(new SetupAuth(new User("testuser")));
    }
View Full Code Here

                    then().
                        statusCode(Status.OK.getStatusCode()).
                when().
                    get(testURL.toExternalForm());
            }
        }).inspect(new SetupAuth(new User("testuser")));
    }
View Full Code Here

                    then().
                        statusCode(Status.OK.getStatusCode()).
                when().
                    put(testURL.toExternalForm());
            }
        }).inspect(new SetupAuth(new User("testuser")));
    }
View Full Code Here

                    then().
                        statusCode(Status.OK.getStatusCode()).
                when().
                    post(testURL.toExternalForm());
            }
        }).inspect(new SetupAuth(new User("testuser")));
    }
View Full Code Here

                    then().
                        statusCode(Status.OK.getStatusCode()).
                when().
                    delete(testURL.toExternalForm());
            }
        }).inspect(new SetupAuth(new User("testuser")));
    }
View Full Code Here

                    then().
                        statusCode(Status.OK.getStatusCode()).
                when().
                    patch(testURL.toExternalForm());
            }
        }).inspect(new SetupAuth(new User("testuser")));
    }
View Full Code Here

    }

    @GET
    @Produces({BASE_XML_MEDIA_TYPE, BASE_JSON_MEDIA_TYPE})
    public Response whoami() {
        User currentUser = user.get();
        if(currentUser == null) {
            return Response.status(Status.UNAUTHORIZED).build();
        }
        String userId = currentUser.getId();
        return Response.seeOther(
                UriBuilder.fromResource(UserResource.class).segment(userId).build())
            .build();
    }
View Full Code Here

    //public void registerUser(@Observes SocialEvent<OAuthSession> event) { https://issues.jboss.org/browse/AGOVA-53
    public void registerUser(@Observes SuccessfulAuthentication event) {
        TwitterProfile profile = (TwitterProfile)event.getProfile();

        User user = repository.get(profile.getScreenName());
        if(user == null) {
            user = new User(profile.getScreenName());
        }
        user.setName(profile.getFullName());
        user.setBio(profile.getDescription());
        user.setAvatarUrl(profile.getProfileImageUrl());
        OAuthToken token = event.getToken();
        user.setAccessToken(token.getSecret() + "|" + token.getToken());
        if(user.getApiToken() == null) {
            user.setApiToken(UUID.randomUUID().toString());
        }

        repository.store(user);
    }
View Full Code Here

        } else {
            if(session.isConnected()) { // already got a active session going
                OAuthSession session = service.getSession();
                UserProfile userProfile = session.getUserProfile();

                User user = repository.get(userProfile.getId());
                if(user == null) {  // can't find a matching account, shouldn't really happen
                    setStatus(AuthenticationStatus.FAILURE);
                } else {
                    setAccount(new UserAccount(user));
                    setStatus(AuthenticationStatus.SUCCESS);
                }
            } else {
                // Callback
                String verifier = request.getParameter(service.getVerifierParamName());
                if(verifier != null) {
                    session.setVerifier(verifier);
                    service.initAccessToken();

                    // https://issues.jboss.org/browse/AGOVA-53
                    successful.fire(new SuccessfulAuthentication(service.getSession().getUserProfile(), service.getAccessToken()));

                    String screenName = ((TwitterProfile)service.getSession().getUserProfile()).getScreenName();
                    User user = repository.get(screenName);
                    if(user == null) { // can't find a matching account
                        setStatus(AuthenticationStatus.FAILURE);
                    } else {
                        setAccount(new UserAccount(user));
                        setStatus(AuthenticationStatus.SUCCESS);
                        response.addCookie(new Cookie(AUTH_COOKIE_NAME, user.getApiToken()));
                    }

                } else {
                    // initiate redirect request to 3. party
                    String redirectUrl = service.getAuthorizationUrl();
View Full Code Here

TOP

Related Classes of org.cedj.geekseek.domain.user.model.User

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.