public ModeledUser retrieveUser ( AuthenticationProvider authenticationProvider , AuthenticatedUser authenticatedUser ) throws GuacamoleException { // If we already queried this user, return that rather than querying again if ( authenticatedUser instanceof ModeledAuthenticatedUser ) return ( ( ModeledAuthenticatedUser ) authenticatedUser ) . getUser ( ) ; // Get username String username = authenticatedUser . getIdentifier ( ) ; // Retrieve corresponding user model, if such a user exists UserModel userModel = userMapper . selectOne ( username ) ; if ( userModel == null ) return null ; // Create corresponding user object, set up cyclic reference ModeledUser user = getObjectInstance ( null , userModel ) ; user . setCurrentUser ( new ModeledAuthenticatedUser ( authenticatedUser , authenticationProvider , user ) ) ; // Return already-authenticated user return user ; }
Retrieves the user corresponding to the given AuthenticatedUser from the database .