Package org.springframework.boot.autoconfigure.security.SecurityProperties

Examples of org.springframework.boot.autoconfigure.security.SecurityProperties.User


  @Autowired
  private SecurityProperties security;

  @Override
  public void init(AuthenticationManagerBuilder auth) throws Exception {
    User user = security.getUser();
    // @formatter:off
    auth.jdbcAuthentication().dataSource(dataSource)
      .withUser(user.getName())
      .password(user.getPassword())
      .roles(user.getRole().toArray(new String[0]));
    // @formatter:on
  }
View Full Code Here


      if (auth.isConfigured()) {
        this.defaultAuth = auth;
        return;
      }

      User user = AuthenticationManagerConfiguration.this.security.getUser();
      if (user.isDefaultPassword()) {
        logger.info("\n\nUsing default security password: " + user.getPassword()
            + "\n\n");
      }

      this.defaultAuth = new AuthenticationManagerBuilder(
          AuthenticationManagerConfiguration.this.objectPostProcessor);

      Set<String> roles = new LinkedHashSet<String>(user.getRole());

      this.parent = this.defaultAuth.inMemoryAuthentication()
          .withUser(user.getName()).password(user.getPassword())
          .roles(roles.toArray(new String[roles.size()])).and().and().build();

      // Defer actually setting the parent on the AuthenticationManagerBuilder
      // because it makes it "configured" and we are only in the init() phase
      // here.
View Full Code Here

TOP

Related Classes of org.springframework.boot.autoconfigure.security.SecurityProperties.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.