简体   繁体   English

Spring Boot Security默认密码

[英]Spring Boot Security Default Password

i have a strange problem when i launch my spring application it used to print a default password to login in the browser but now ther isn't : 我启动我的spring应用程序时遇到一个奇怪的问题,它用来打印默认密码以在浏览器中登录,但是现在不是:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.3.RELEASE)

2017-06-26 17:04:32.024  INFO 28712 --- [           main] com.o2xp.ats.accountManager.App          : Starting App on frozzen-PC with PID 28712 (/home/frozzen/workspace/ATS/ats-parent/ats-impl/ats-accountManager/target/classes started by frozzen in /home/frozzen/workspace/ATS/ats-parent/ats-impl/ats-accountManager)
2017-06-26 17:04:32.030  INFO 28712 --- [           main] com.o2xp.ats.accountManager.App          : No active profile set, falling back to default profiles: default
2017-06-26 17:04:32.282  INFO 28712 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@45f45fa1: startup date [Mon Jun 26 17:04:32 CEST 2017]; root of context hierarchy
2017-06-26 17:04:35.685  INFO 28712 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-06-26 17:04:35.723  INFO 28712 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2017-06-26 17:04:35.724  INFO 28712 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.14
2017-06-26 17:04:35.962  INFO 28712 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-06-26 17:04:35.962  INFO 28712 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3688 ms
2017-06-26 17:04:36.361  INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-06-26 17:04:36.362  INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-06-26 17:04:36.362  INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-06-26 17:04:36.362  INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-06-26 17:04:36.364  INFO 28712 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2017-06-26 17:04:36.365  INFO 28712 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-06-26 17:04:37.170  INFO 28712 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-06-26 17:04:37.195  INFO 28712 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2017-06-26 17:04:37.300  INFO 28712 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
2017-06-26 17:04:37.302  INFO 28712 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2017-06-26 17:04:37.305  INFO 28712 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2017-06-26 17:04:37.373  INFO 28712 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-06-26 17:04:37.741  INFO 28712 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2017-06-26 17:04:38.642  INFO 28712 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2017-06-26 17:04:38.721  INFO 28712 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete
2017-06-26 17:04:38.767  INFO 28712 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-06-26 17:04:39.857  INFO 28712 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@ff0e6d4, org.springframework.security.web.context.SecurityContextPersistenceFilter@1a785fd5, org.springframework.security.web.header.HeaderWriterFilter@1d1bf7bf, org.springframework.security.web.csrf.CsrfFilter@748904e8, org.springframework.security.web.authentication.logout.LogoutFilter@650a1aff, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@10bf1ec9, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@8f39224, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@7606bd03, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@362a561e, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@ad0bb4e, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@70d3cdbf, org.springframework.security.web.session.SessionManagementFilter@4d43a1b7, org.springframework.security.web.access.ExceptionTranslationFilter@919086, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@6b3f4bd8]
2017-06-26 17:04:40.221  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@45f45fa1: startup date [Mon Jun 26 17:04:32 CEST 2017]; root of context hierarchy
2017-06-26 17:04:40.323  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/registration],methods=[POST]}" onto public java.lang.String com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.registration(com.o2xp.ats.accountManager.to.ApplicantTO,org.springframework.validation.BindingResult,org.springframework.ui.Model)
2017-06-26 17:04:40.324  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/registration],methods=[GET]}" onto public java.lang.String com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.registration(org.springframework.ui.Model)
2017-06-26 17:04:40.325  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories],methods=[GET]}" onto public java.util.List<com.o2xp.ats.accountManager.to.ApplicantTO> com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.getAllApplicants()
2017-06-26 17:04:40.326  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories/{id}],methods=[GET]}" onto public org.springframework.http.ResponseEntity<com.o2xp.ats.accountManager.ti.ApplicantTI> com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.getApplicantById(java.lang.Long)
2017-06-26 17:04:40.326  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/login],methods=[GET]}" onto public java.lang.String com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.login(org.springframework.ui.Model,java.lang.String,java.lang.String)
2017-06-26 17:04:40.327  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/ || /welcome],methods=[GET]}" onto public java.lang.String com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.welcome(org.springframework.ui.Model)
2017-06-26 17:04:40.327  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/categories/{id}],methods=[DELETE]}" onto public org.springframework.http.ResponseEntity<java.lang.Void> com.o2xp.ats.accountManager.rest.controllers.ApplicantResource.deleteApplicant(java.lang.Long)
2017-06-26 17:04:40.333  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-06-26 17:04:40.334  INFO 28712 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-06-26 17:04:40.380  INFO 28712 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-26 17:04:40.380  INFO 28712 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-26 17:04:40.445  INFO 28712 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-06-26 17:04:40.821  INFO 28712 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-06-26 17:04:40.894  INFO 28712 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-06-26 17:04:40.901  INFO 28712 --- [           main] com.o2xp.ats.accountManager.App          : Started App in 9.52 seconds (JVM running for 10.076)

and here is my App : 这是我的应用程序:

package com.o2xp.ats.accountManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;

/**
 * Hello world!
 *
 */
@SpringBootApplication
@ComponentScan({ "com.o2xp.ats.common.domain", "com.o2xp.ats.common.services", "com.o2xp.ats.common.mapper",
        "com.o2xp.ats.accountManager.services", "com.o2xp.ats.accountManager.mapper",
        "com.o2xp.ats.accountManager.domain", "com.o2xp.ats.accountManager.rest.controllers",
        "com.o2xp.ats.accountManager.validator" })
@EnableJpaRepositories({ "com.o2xp.ats.common.repository", "com.o2xp.ats.accountManager.repository" })
@EntityScan({ "com.o2xp.ats.common.domain", "com.o2xp.ats.accountManager.domain" })
@EnableWebSecurity
public class App extends org.springframework.boot.web.support.SpringBootServletInitializer {

    private static final Logger log = LoggerFactory.getLogger(App.class);

    public static void main(String[] args) {
        SpringApplication.run(App.class);
    }

i've seen 我见过

If you fine-tune your logging configuration, ensure that the org.springframework.boot.autoconfigure.security category is set to log INFO messages, otherwise the default password will not be printed. 如果您微调日志记录配置,请确保将org.springframework.boot.autoconfigure.security类别设置为记录INFO消息,否则将不会输出默认密码。

into the spring doc but don't know where is the file to modify. 进入Spring文档,但不知道要在哪里修改文件。

You need to add the key and logging level to application.properties. 您需要将密钥和日志记录级别添加到application.properties。 Have a look here 在这里看看

Set logging level at application.properties . application.properties中设置日志记录级别。 Take a look 26.4 Log Levels 看一下26.4 日志级别

logging.level.org.springframework.boot.autoconfigure.security=INFO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM