Package opensnap.domain

Examples of opensnap.domain.User


  @BeforeTest
  public void setup() {
    MockitoAnnotations.initMocks(this);
    CompletableFuture<User> eric = new CompletableFuture<>();
    eric.complete(new User("eric", "3r1c", Arrays.asList("USER")));
    when(userService.getByUsername("eric")).thenReturn(eric);
    CompletableFuture<User> michel = new CompletableFuture<>();
    michel.complete(new User("michel", "m1ch3l", Arrays.asList("USER", "ADMIN")));
    when(userService.getByUsername("michel")).thenReturn(michel);
    this.interceptor = new SecurityChannelInterceptor(this.userService);
    this.interceptor.loadConfiguration("test-security.yml");
  }
View Full Code Here


  @Bean
  public InitializingBean populateTestData(UserService userService) {
    return () -> {
      if (!userService.exists("anonymous").get()) {
        userService.create(new User("anonymous", "jdqsjkdjsqkjd", Arrays.asList("ANONYMOUS")));
        userService.create(new User("seb", "s3b", Arrays.asList("USER", "ADMIN")));
        userService.create(new User("adeline", "ad3l1n3", Arrays.asList("USER")));
        userService.create(new User("johanna", "j0hanna", Arrays.asList("USER")));
        userService.create(new User("michel", "m1ch3l", Arrays.asList("USER")));
      }
    };
  }
View Full Code Here

  }

  protected boolean isAllowed(String destination, String username) {
    try {
      User  user = this.userService.getByUsername(username).get();
      if(user == null) {
        return false;
      }
      List<String> userRoles = user.getRoles();
      return browseMap(this.securityDefinitions, "/", destination, userRoles);
    } catch (ExecutionException|InterruptedException e) {
      logger.error(e.getMessage());
      return false;
    }
View Full Code Here

TOP

Related Classes of opensnap.domain.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.