Jave find by username user repository

60 Jave code examples are found related to " find by username user repository". You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
Example 1
Source File: CRUDUserRepositoryIT.java    From es with Apache License 2.0 6 votes vote down vote up
@Test
public void testFindByUsername() {
    userRepository.save(user);
    User dbUser = userRepository.findByUsername(user.getUsername());

    assertNotNull(dbUser);
}
 
Example 2
Source File: MongoUserRepository.java    From graviteeio-access-management with Apache License 2.0 6 votes vote down vote up
@Override
public Maybe<User> findByUsernameAndDomain(String domain, String username) {
    return Observable.fromPublisher(
            usersCollection
                    .find(and(eq(FIELD_REFERENCE_TYPE, DOMAIN.name()), eq(FIELD_REFERENCE_ID, domain), eq(FIELD_USERNAME, username)))
                    .limit(1)
                    .first())
            .firstElement()
            .map(this::convert);
}
 
Example 3
Source File: UserRepositoryJdbc.java    From spring-oauth-server with GNU General Public License v2.0 5 votes vote down vote up
@Override
public User findByUsername(String username) {
    final String sql = " select * from user_ where username = ? and archived = 0 ";
    final List<User> list = this.jdbcTemplate.query(sql, new Object[]{username}, userRowMapper);

    User user = null;
    if (!list.isEmpty()) {
        user = list.get(0);
        user.privileges().addAll(findPrivileges(user.id()));
    }

    return user;
}
 
Example 4
Source File: UserRepositoryTest.java    From code-examples with MIT License 5 votes vote down vote up
@Test
void findUserByUsername() {
  // given
  String username = "user";

  // when
  UserCredentials userCredentials = userRepository.findByUsername(username);

  // then
  assertThat(userCredentials).isNotNull();
}
 
Example 5
Source File: UserSocialConnectionRepositoryTest.java    From JiwhizBlogWeb with Apache License 2.0 5 votes vote down vote up
@Test
public void testFindByUsernameAndProviderIdAndProviderUserId(){
    setupUserSocialConnectionList();
    
    UserSocialConnection result = userSocialConnectionRepository.findByUserIdAndProviderIdAndProviderUserId("jiwhiz", "google", "google-jiwhiz");
    assertNotNull(result);

    result = userSocialConnectionRepository.findByUserIdAndProviderIdAndProviderUserId("jiwhiz", "google", "google-jiwhiz2");
    assertNull(result);
}
 
Example 6
Source File: UserRepository.java    From java-starthere with MIT License 4 votes vote down vote up
List<User> findByUsernameContainingIgnoreCase(String name,
Pageable pageable);
 
Example 7
Source File: BasicUserRepository.java    From tutorials with MIT License 4 votes vote down vote up
@EntityGraph(attributePaths = "permissions")
Optional<BasicUser> findDetailedByUsername(String username);
 
Example 8
Source File: UserRepository.java    From spring-mvc-react with MIT License 4 votes vote down vote up
@Query("select t from User t where t.username = :username")
User findByUsername(@Param("username") String username);
 
Example 9
Source File: UserRepositoryIntegrationTest.java    From spring-security-mongo with MIT License 4 votes vote down vote up
@Test
public void shouldFindUserByUsername() {
    //Given
    final User user = UserBuilder.userBuilder().build();
    final User savedUser = userRepository.save(user);

    //When
    final Optional<User> userFound = userRepository.findByUsername(user.getUsername());

    //Then
    assertThat(userFound.isPresent()).isTrue();
    assertThat(userFound.get()).isEqualTo(savedUser);
}
 
Example 10
Source File: UserRepository.java    From alf.io with GNU General Public License v3.0 4 votes vote down vote up
@Query("select * from ba_user where username = :username")
Optional<User> findByUsername(@Bind("username") String username);
 
Example 11
Source File: UserRepository.java    From alf.io with GNU General Public License v3.0 4 votes vote down vote up
@Query("select password from ba_user where username = :username and enabled = true")
Optional<String> findPasswordByUsername(@Bind("username") String username);
 
Example 12
Source File: UserRepository.java    From keycloak-user-storage-provider-demo with Apache License 2.0 4 votes vote down vote up
public User findUserByUsernameOrEmail(String username) {
  return users.stream()
    .filter(user -> user.getUsername().equalsIgnoreCase(username) || user.getEmail().equalsIgnoreCase(username))
    .findFirst().get();
}
 
Example 13
Source File: UserRepositoryImpl.java    From the-app with Apache License 2.0 4 votes vote down vote up
@Override
public User findByUsername(String username) {
    return mongoOperations.findOne(new Query(Criteria.where("username").is(username)), User.class);
}
 
Example 14
Source File: UserRepositoryImpl.java    From AppStash with Apache License 2.0 4 votes vote down vote up
@Override
public User findByUsername(String username) {
    return mongoOperations.findOne(new Query(Criteria.where("username").is(username)), User.class);
}
 
Example 15
Source File: RepositoryUserDetailsService.java    From bookstore-service-broker with Apache License 2.0 4 votes vote down vote up
@Override
public Mono<UserDetails> findByUsername(String username) {
	return userRepository.findByUsername(username)
			.switchIfEmpty(Mono.error(new UsernameNotFoundException(username)))
			.flatMap(user -> Mono.just(new CustomUserDetails(user)));
}
 
Example 16
Source File: MapUserDetailsRepository.java    From spring-security-reactive with Apache License 2.0 4 votes vote down vote up
@Override
public Mono<UserDetails> findByUsername(String username) {
	// FIXME case insensitive support
	UserDetails result = users.get(username);
	return result == null ? Mono.empty() : Mono.just(result);
}
 
Example 17
Source File: UserRepositoryTest.java    From building-microservices with Apache License 2.0 4 votes vote down vote up
@Test
public void findByUsernameWhenNoUserShouldReturnNull() throws Exception {
	this.entityManager.persist(new User("donald", VIN));
	User user = this.repository.findByUsername("minnie");
	assertThat(user).isNull();
}
 
Example 18
Source File: UserRepository.java    From spring-boot-oauth2-jwt with MIT License 4 votes vote down vote up
@Query("SELECT u FROM User u WHERE (u.deletedOn > CURRENT_TIMESTAMP OR u.deletedOn IS NULL) AND u.username = :username")
User findActiveByUsername(@Param("username") String username);
 
Example 19
Source File: CachingUserRepository.java    From spring-data-examples with Apache License 2.0 4 votes vote down vote up
@Cacheable("byUsername")
User findByUsername(String username);
 
Example 20
Source File: SysUserRepository.java    From spring-boot-demo with MIT License 2 votes vote down vote up
/**
 * 通过用户名查找用户.
 *
 * @param username 用户名
 * @return 结果
 */
Optional<SysUser> findFirstByUsername(String username);
 
Example 21
Source File: PersistentUserDetailsRepository.java    From spring-ws-security-soap-example with MIT License 2 votes vote down vote up
/**
 * Returns the user details for the received username.
 * 
 * @param username
 *            username to search for
 * @return the user details for the received username
 */
public PersistentUserDetails findOneByUsername(final String username);
 
Example 22
Source File: UserRepository.java    From Fame with MIT License 2 votes vote down vote up
/**
 * 根据用户名查询用户
 * @param username 用户名
 * @return User
 */
User findByUsername(String username);
 
Example 23
Source File: UserRepository.java    From xiaoyuanxianyu with Apache License 2.0 2 votes vote down vote up
/**
 * @param username 用户名
 * @param password 密码
 * @return 返回用户 否则为空
 * */
User findByUsernameAndPassword(String username , String password);
 
Example 24
Source File: UserRepository.java    From springboot-learning-experience with Apache License 2.0 2 votes vote down vote up
/**
 * 根据用户名查询用户信息
 *
 * @param username 用户名
 * @return 查询结果
 */
List<User> findAllByUsername(String username);
 
Example 25
Source File: UserRepository.java    From incubator-wikift with Apache License 2.0 2 votes vote down vote up
/**
 * 根据用户名称查找用户
 *
 * @param username 用户名
 * @return 用户信息
 */
UserEntity findByUsername(String username);
 
Example 26
Source File: UserRepository.java    From enhanced-pet-clinic with Apache License 2.0 2 votes vote down vote up
/**
 * Retrieve <code>User</code> from the data store by username.
 *
 * @param lastName
 *            Value to search for
 * @return a <code>Collection</code> of matching <code>User</code>s (or an
 *         empty <code>Collection</code> if none found)
 */
User findByUsername(String username) throws DataAccessException;
 
Example 27
Source File: UserRepository.java    From web-budget with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Find an {@link User} by the username
 * 
 * @param username the username to find the {@link User} object
 * @return an {@link Optional} of the {@link User}
 */
Optional<User> findByUsername(String username);
 
Example 28
Source File: UserRepository.java    From tutorials with MIT License 0 votes vote down vote up
List<User> findByUsernameLikeIgnoreCase(String username); 
Example 29
Source File: UserRepository.java    From WIFIProbe with Apache License 2.0 0 votes vote down vote up
UserEntity findByUsernameAndPassword(String username,String password); 
Example 30
Source File: UserRepository.java    From boot-stateless-social with MIT License 0 votes vote down vote up
User findByUsername(String username); 
Example 31
Source File: UserRepository.java    From DiscordSoundboard with Apache License 2.0 0 votes vote down vote up
User findOneByIdOrUsernameIgnoreCase(String id, String userName); 
Example 32
Source File: UserRepository.java    From sanshanblog with Apache License 2.0 0 votes vote down vote up
UserDO findByUsername(final String usernmae); 
Example 33
Source File: UserRepository.java    From egeria with Apache License 2.0 0 votes vote down vote up
Optional<User> findOneByUsername(String username); 
Example 34
Source File: UserRepository.java    From code-examples with MIT License 0 votes vote down vote up
UserCredentials findByUsername(String username); 
Example 35
Source File: UserAccountRepository.java    From oauth2-server with MIT License 0 votes vote down vote up
Page<UserAccountEntity> findByUsernameLike(String username, Pageable page); 
Example 36
Source File: UserRepository.java    From NoteBlog with MIT License 0 votes vote down vote up
User findByUsernameAndPasswordAndEnable(String username, String password, boolean enable); 
Example 37
Source File: IUserRepository.java    From sctalk with Apache License 2.0 0 votes vote down vote up
ManagerUser findByUsername(String username); 
Example 38
Source File: UserProfileRepository.java    From jakduk-api with MIT License 0 votes vote down vote up
Optional<UserProfile> findOneByUsername(String username); 
Example 39
Source File: AdminUserRepository.java    From OpenLRW with Educational Community License v2.0 0 votes vote down vote up
Optional<AdminUser> findByUsername(final String userName); 
Example 40
Source File: UserRepository.java    From docs-manage with MIT License 0 votes vote down vote up
User findByUsername(String username); 
Example 41
Source File: UserRepository.java    From bearchoke with Apache License 2.0 0 votes vote down vote up
User findByUsername(String username); 
Example 42
Source File: UserRepository.java    From abixen-platform with GNU Lesser General Public License v2.1 0 votes vote down vote up
User findByUsername(String username); 
Example 43
Source File: UserRepository.java    From youkefu with Apache License 2.0 0 votes vote down vote up
public abstract User findByUsernameAndOrgi(String paramString, String orgi); 
Example 44
Source File: UserRepository.java    From LazyREST with Apache License 2.0 0 votes vote down vote up
UserEntity findByUsername(String username); 
Example 45
Source File: UserRepository.java    From spring-reactive-sample with GNU General Public License v3.0 0 votes vote down vote up
Mono<User> findByUsername(String username); 
Example 46
Source File: UserInfoRepository.java    From hygieia-core with Apache License 2.0 0 votes vote down vote up
UserInfo findByUsernameAndAuthType(String username, AuthType authType); 
Example 47
Source File: UserInfoRepository.java    From hygieia-core with Apache License 2.0 0 votes vote down vote up
Iterable<UserInfo> findByOrderByUsernameAsc(); 
Example 48
Source File: UserRepository.java    From apollo with Apache License 2.0 0 votes vote down vote up
List<UserPO> findByUsernameIn(List<String> userNames); 
Example 49
Source File: UserReactiveRepository.java    From spring-5-examples with MIT License 0 votes vote down vote up
Mono<User> findByUsername(final String username); 
Example 50
Source File: UserRepository.java    From Spring-Boot-Blog-REST-API with GNU Affero General Public License v3.0 0 votes vote down vote up
Optional<User> findByUsername(@NotBlank String username); 
Example 51
Source File: UserRepository.java    From Spring-Boot-Blog-REST-API with GNU Affero General Public License v3.0 0 votes vote down vote up
Optional<User> findByUsernameOrEmail(String username, String email); 
Example 52
Source File: UserRepository.java    From spring-boot-jwt with MIT License 0 votes vote down vote up
User findByUsername(String username); 
Example 53
Source File: UserRepository.java    From StudentListFinal with MIT License 0 votes vote down vote up
User findByUsername(String username); 
Example 54
Source File: UserRepository.java    From youkefu with Apache License 2.0 0 votes vote down vote up
public abstract User findByUsernameAndDatastatus(String username, boolean datastatus); 
Example 55
Source File: UserRepository.java    From youkefu with Apache License 2.0 0 votes vote down vote up
public abstract User findByUsernameAndPassword(String paramString1, String password); 
Example 56
Source File: UserRepository.java    From youkefu with Apache License 2.0 0 votes vote down vote up
public abstract User findByUsernameAndPasswordAndDatastatus(String username, String password,boolean datastatus); 
Example 57
Source File: UserRepository.java    From java-starthere with MIT License 0 votes vote down vote up
User findByUsername(String username); 
Example 58
Source File: UserRepository.java    From youkefu with Apache License 2.0 0 votes vote down vote up
public abstract Page<User> findByDatastatusAndOrgiAndUsernameLike(boolean datastatus , String orgi ,String username ,Pageable paramPageable); 
Example 59
Source File: UserRepository.java    From torrssen2 with MIT License 0 votes vote down vote up
public User findByUsername(String username); 
Example 60
Source File: UserRepository.java    From JavaSpringMvcBlog with MIT License 0 votes vote down vote up
User findByUsernameIgnoreCase(String username);