Login using user recovery token
@param recoveryToken recovery token for user.
@return Logged in user.
326053
public Observable<BackendUser> getUserFromRecoveryToken(final String recoveryToken){
        return Observable.create(new Observable.OnSubscribe<BackendUser>() {
            @Override
            public void call(Subscriber<? super BackendUser> subscriber) {
                try{
                    setLoginState(LOGGING_IN);

                    ValidCredentials validCredentials = getWebService().getUserFromRecoveryToken(recoveryToken).toBlockingObservable().first();
                    if(validCredentials == null) throw new Exception("Null User Returned");

                    subscriber.onNext(setUser(validCredentials));
                }catch (Exception e){
                    setLoginState(LOGGED_OUT);
                    subscriber.onError(e);
                }
            }
        });
    }
72514
public base_response loginchallengeresponse(String response) throws Exception
	{
		loginchallengeresponse logincr = new loginchallengeresponse(response);
		base_response result = logincr.perform_operation(this);
		if (result.errorcode == 0)
			this.sessionid = result.sessionid;
		return result;
	}
650471
public String login( String user, String pwd ) {

		String token = null;
		try {
			this.authService.authenticate( user, pwd );

			token = UUID.randomUUID().toString();
			Long now = new Date().getTime();
			this.tokenToLoginTime.put( token, now );
			this.tokenToUsername.put( token, user );

		} catch( LoginException e ) {
			this.logger.severe( "Invalid login attempt by user " + user );
		}

		return token;
	}
1364290
public User getLoggedInUser() {
    User user = null;

    final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication != null) {
      final Object principal = authentication.getPrincipal();

      // principal can be "anonymousUser" (String)
      if (principal instanceof UserDetails) {
        user = userDetailsConverter.convert((UserDetails) principal);
      }
    }
    return user;
  }
683737
public function getLoginToken(UserInterface $user, UuidInterface $token) : LoginToken
    {
        return new LoginToken(
            $user->getId(),
            $token
        );
    }
249889
public login logout() throws Exception
	{
		if(sessionid == null || sessionid.length() <= 0)
			throw new Exception("User not logged-in");
		
		login logout_obj = new login();
		logout_obj.set_sessionid(sessionid);
		
		login result = login.delete(this, logout_obj);
		sessionid = null;
		user_name = null;
		password = null;
		return result;
	}
72125
function logon() {
    var dfrd = Q.defer();
    var token = cache.get('token');

    function extractToken(xml) {
      var r = _parse(xml, dfrd);
      if (r) {
        return r.response.token[0];
      }
    }

    if (token) {
      dfrd.resolve({
        token: token,
        cached: true
      });
    }

    request(format(URLs.logon, PROTOCOL, conf.host, conf.username,
        conf.password),
      function(err, res, body) {
        var newToken;
        if (err) {
          dfrd.reject(err);
        } else {
          newToken = extractToken(body);
          if (!newToken) {
            dfrd.reject(MODULE_ERRORS.unknown);
          } else {
            cache.put('token', newToken);
            dfrd.resolve({
              token: newToken,
              cached: false
            });
          }
        }
      });
    return dfrd.promise;
  }
827414
private RegistryAuth authForAccessToken(final AccessToken accessToken) {
    return RegistryAuth.builder()
        .username("oauth2accesstoken")
        .password(accessToken.getTokenValue())
        .build();
  }
848551
private String getToken() {

        SessionData session = dataMgr.getSessionDAO().session();
        if (session != null && session.getExpiresOn() > System.currentTimeMillis()) {
            return session.getAccessToken();
        }

        return null;
    }
290317
public String auth_getSession(String authToken)
    throws FacebookException, IOException {
    if (null != this._sessionKey) {
      return this._sessionKey;
    }
    JSONObject d = (JSONObject) this.callMethod(FacebookMethod.AUTH_GET_SESSION, 
                                                new Pair<String, CharSequence>("auth_token", authToken.toString()));
    this._sessionKey = (String) d.get("session_key");
    Object uid = d.get("uid");
    try {
      this._userId = ((Long) uid).intValue();
    } catch (ClassCastException cce) {
      this._userId = Integer.parseInt((String) uid);
    } 
    if (this.isDesktop()) {
      this._sessionSecret = (String) d.get("secret");
    }
    return this._sessionKey;
  }
974094
public String signToken(AuthenticatedUser user) {
        Date expiry = new Date(System.currentTimeMillis() + this.jwtTimeout);
        JWTClaimsSet claimsSet = user.toClaimSet(this.jwtIssuer, expiry);
        SignedJWT jwt = this.signToken(claimsSet);
        return jwt.serialize();
    }
600152
public Authentication getAuthentication(String token) {
		if (null != token) {
			TokenContainer container = tokens.get(token);
			if (null != container) {
				if (container.isValid()) {
					return container.getAuthentication();
				} else {
					logout(token);
				}
			}
		}
		return null;
	}
714458
@CheckReturnValue(when = When.NEVER)
  public boolean isLoggedIn() {
    authLock.readLock().lock();
    try {
      return activeUser != null && activeUser.isLoggedIn();
    } finally {
      authLock.readLock().unlock();
    }
  }
990262
public Account check(AuthenticationToken authenticationToken) {
        Account account = authenticate(authenticationToken);
        if (account == null) {
            throw new AuthenticationException("Invalid credentials");
        }
        return account;
    }
266723
@Restricted(NoExternalUse.class)
    public @Nullable ApiTokenStore.HashedToken getLegacyTokenOf(@Nonnull User user) {
        ApiTokenProperty apiTokenProperty = user.getProperty(ApiTokenProperty.class);
        return apiTokenProperty.getTokenStore().getLegacyToken();
    }
1336112
public int auth_getUserId(String authToken)
    throws FacebookException, IOException {
    /*
     * Get the session information if we don't have it; this will populate
	   * the user ID as well.
	   */
    if (null == this._sessionKey)
      auth_getSession(authToken);
    return this._userId;
  }
1038870
private String getAuthenticationToken() {

        String token = request.getParameter("token");
        if (token != null && !token.isEmpty())
            return token;
        
        return null;

    }