* used by the user has already been taken
*/
private AuthState handleRegistration(
AuthInitialization authInit) {
IAuthService service = serviceProvider.getAuthServices().get(
authInit.getAuthServiceName());
authInitService.clear();
if (service == null) {
throw new AuthException("No authentication service was " +
"registered with the resource name: " +
authInit.getAuthServiceName());
}
String serviceSpecificSessionId = service.getServiceSpecificSessionId();
//If the user comes back to the site without being authenticated (the
//nerve), then the new auth state is "registrationFailed". This is
//returned as part of the compelte auth state and allows the app to
//decide how this information is presented and handled
if (Strings.isNullOrEmpty(serviceSpecificSessionId)) {
return AuthState.externalAuthenticationFailed;
}
String serviceSpecificUserId =
service.getServiceSpecificUserId(serviceSpecificSessionId);
//At this point we are pretty certain the user is logged in because we
//have a service-specific sessionId. However some services don't use
//a service specific session Id, so we have to verify that the retrtied
//service-specific user id is valid.