Search in sources :

Example 1 with SocialAPI

use of org.mamute.auth.SocialAPI in project mamute by caelum.

the class FacebookAuthController method signupViaFacebook.

@Get("/sign-up/facebook/")
public void signupViaFacebook(String code, String state) {
    if (code == null) {
        includeAsList("mamuteMessages", i18n("error", "error.signup.facebook.unknown"));
        redirectTo(SignupController.class).signupForm();
        return;
    }
    Token token = service.getAccessToken(null, new Verifier(code));
    SocialAPI facebookAPI = new FacebookAPI(service, token);
    boolean success = loginManager.merge(MethodType.FACEBOOK, facebookAPI);
    if (!success) {
        includeAsList("mamuteMessages", i18n("error", "signup.errors.facebook.invalid_email", state));
        result.redirectTo(AuthController.class).loginForm(state);
        return;
    }
    redirectToRightUrl(state);
}
Also used : FacebookAPI(org.mamute.auth.FacebookAPI) Token(org.scribe.model.Token) Verifier(org.scribe.model.Verifier) SocialAPI(org.mamute.auth.SocialAPI) Get(br.com.caelum.vraptor.Get)

Example 2 with SocialAPI

use of org.mamute.auth.SocialAPI in project mamute by caelum.

the class GoogleAuthController method signUpViaGoogle.

@Get("/sign-up/google/")
public void signUpViaGoogle(String state, String code) {
    Token token = service.getAccessToken(null, new Verifier(code));
    SocialAPI googleAPI = new GoogleAPI(token, service);
    loginManager.merge(MethodType.GOOGLE, googleAPI);
    redirectToRightUrl(state);
}
Also used : GoogleAPI(org.mamute.auth.GoogleAPI) Token(org.scribe.model.Token) Verifier(org.scribe.model.Verifier) SocialAPI(org.mamute.auth.SocialAPI) Get(br.com.caelum.vraptor.Get)

Aggregations

Get (br.com.caelum.vraptor.Get)2 SocialAPI (org.mamute.auth.SocialAPI)2 Token (org.scribe.model.Token)2 Verifier (org.scribe.model.Verifier)2 FacebookAPI (org.mamute.auth.FacebookAPI)1 GoogleAPI (org.mamute.auth.GoogleAPI)1