Как обеспечить возврат пароля в Spring-WS - PullRequest
0 голосов
/ 27 июня 2019

Я использую весеннюю загрузку 2 и получаю следующую ошибку:

org.springframework.ws.soap.security.wss4j2.Wss4jSecuritySecurementException: обратный вызов пароля не предоставляется;вложенное исключение: org.apache.wss4j.common.ext.WSSecurityException: обратный вызов пароля не предоставляется в org.springframework.ws.soap.security.wss4j2.Wss4jSecurityInterceptor.secureMessage (Wss4jSecurityInterceptor.java:577s - spring)3.0.7.RELEASE.jar: na] at org.springframework.ws.soap.security.AbstractWsSecurityInterceptor.handleRequest (AbstractWsSecurityInterceptor.java:210) ~ [spring-ws-security-3.0.7.RELEASE.jar: na] atorg.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive (WebServiceTemplate.java:597) [spring-ws-core-3.0.7.RELEASE.jar: na] в org.springframework.ws.client.core.WlateSvicesendAndReceive (WebServiceTemplate.java:555) [spring-ws-core-3.0.7.RELEASE.jar: na] at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive (WebServiceTemplate.java:-ws)-core-3.0.7.RELEASE.jar: na] at aero.sita.gsl.config.VisaAppAdaptor.getApplicationNumber (VisaAppAdaptor.java:27) [classes /: na] в aero.sita.gsl.controller.VisaApplicationSearchController.getVisaDetails (VisaApplicationSearchController.java:33) [classes /: na] at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) ~ [na: 1.8.0_212] at sun.reflect.NativeMethodAccessorImp (неизвестно) [известноna: 1.8.0_212] at sun.reflect.DelegatingMethodAccessorImpl.invoke (неизвестный источник) ~ [na: 1.8.0_212] at java.lang.reflect.Method.invoke (неизвестный источник) ~ [na: 1.8.0_212] в организации.springframework.web.method.support.InvocableHandlerMethod.doInvoke (InvocableHandlerMethod.java:190) [spring-web-5.2.0.M3.jar: 5.2.0.M3] в org.springframework.web.method.suppandInv.invokeForRequest (InvocableHandlerMethod.java:138) [spring-web-5.2.0.M3.jar: 5.2.0.M3] в org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHolv (Serv): 105) [spring-webmvc-5.2.0.M3.jar: 5.2.0.M3] в org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod (RequestMappingHandlerAdapter.java: 889) [spring-webmvc-5.2.0.M3.jar: 5.2.0.M3] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal (RequestMappingHandlerAdapter.java:794) [spring-webmvc-5.2.0.M3.jar: 5.2.0.M3] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle (AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.2.0.M3.jar: 5.2.0.M3] в org.springframework.web.servlet.DispatcherServlet.doDispatch (DispatcherServlet.java:1039) [spring-webmvc-5.2.0.M3.jar: 5.2.0.M3] в org.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet.java:942) [spring-webmvc-5.2.0.M3.jar: 5.2.0.M3] в org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java: 1005) [spring-webmvc-5.2.0.M3.jar: 5.2.0.M3] в org.springframework.web.servlet.FrameworkServlet.doGet (FrameworkServlet.java:897) [spring-webmvc-5.2.0.M3.jar: 5.2.0.M3] at javax.servlet.http.HttpServlet.service (HttpServlet.java:634) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet.java:882) [spring-webmvc-5.2.0.M3.jar: 5.2.0.M3] в javax.servlet.http.HttpServlet.service (HttpServlet.java:741) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:231) [tomcat-embed-core-9.0.21.jar: 9.0.21] at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:53) [tomcat-embed-websocket-9.0.21.jar: 9.0.21]в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.core.ApplicationFilterChain.doFilter Application (.java: 166) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.springframework.web.filter.RequestContextFilter.doFilterInternal (RequestContextFilter.java:99) [spring-web-5.2.0.M3.jar: 5.2.0.M3] в org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:109) [spring-web-5.2.0.M3.jar: 5.2.0.M3] в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilter: 166) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.springframework.web.filter.FormContentFilter.doFilterInternal (FormContentFilter.java:92) [spring-web-5.2.0.M3.jar: 5.2.0.M3] at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:109) [spring-web-5.2.0.M3.jar: 5.2.0.M3] в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar: 9.0.21] at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar: 9.0.21] вorg.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal (HiddenHttpMethodFilter.java:93) [spring-web-5.2.0.M3.jar: 5.2.0.M3] в org.springframework.web.filter.OnceilterFestOncePerRequestFilter.java:109) [spring-web-5.2.0.M3.jar: 5.2.0.M3] в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar: 9.0.21] в орг.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (CharacterEncodingFilter.java:200) [spring-web-5.2.0.M3.jar: 5.2.0.M3] at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:109) [spring-web-5.2.0.M3.jar: 5.2.0.M3] в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:202) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:96) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase.java:490) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:13)) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:92) [tomcat-embed-core-9.0.21.jar: 9.0.21] at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:74) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:343) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.coyote.AbstractProcessorLight.process (AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.coyote.AbstractProtocol $ ConnectionHandler.process (AbstractProtocol.java:853) [tomcat-embed-core-9.0.21.jar: 9.0.21] в org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun (NioEndpoint.java:1587) [tomcat-embed-core-9.0.21.jar: 9.0.21]в org.apache.tomcat.util.net.SocketProcessorBase.run (SocketProcessorBase.java:49) [tomcat-embed-core-9.0.21.jar: 9.0.21] в java.util.concurrent.ThreadPoolExecutor.runWorker (Неизвестный источник) [na: 1.8.0_212] at java.util.concurrent.ThreadPoolExecutor $ Worker.run (неизвестный источник) [na: 1.8.0_212] в org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread.java:61) [tomcat-embed-core-9.0.21.jar: 9.0.21] at java.lang.Thread.run (Неизвестный источник) [na: 1.8.0_212] Вызывается: org.apache.wss4j.common.ext.WSSecurityException: обратный вызов пароля не предоставляется в org.apache.wss4j.dom.action.CustomTokenAction.execute (CustomTokenAction.java:42) ~ [wss4j-ws-security-dom-2.2.0.jar: 2.2.0] в org.apache.wss4j.dom.handler.WSHandler.doSenderAction (WSHandler.java:238) ~ [wss4j-ws-security-dom-2.2.0.jar: 2.2.0] в org.springframework.ws.soap.security.wss4j2.Wss4jHandler.doSenderAction (Wss4jHandler.java:63) ~ [spring-ws-security-3.0.7.RELEASE.jar: na] в org.springframework.ws.soap.security.wss4j2.Wss4jSecurityInterceptor.secureMessage (Wss4jSecurityInterceptor.java:574) ~ [spring-ws-security-3.0.7.RELEASE.jar: na] ... 60 общих кадров пропущено

@ конфигурации открытый класс BeanConfig расширяет WsConfigurerAdapter {

@Autowired
private Environment env;

@Bean
public Jaxb2Marshaller marshaller() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("visaapp");
    return marshaller;
}

@Bean
public VisaAppAdaptor soapConnector(Jaxb2Marshaller marshaller) {
    VisaAppAdaptor client = new VisaAppAdaptor();
    client.setDefaultUri(env.getProperty("visa.application.uri"));
    client.setMarshaller(marshaller);
    client.setUnmarshaller(marshaller);
    ClientInterceptor[] interceptor = new ClientInterceptor[]{securityInterceptor()};
    client.setInterceptors(interceptor);
    return client;
}

@Bean
public Wss4jSecurityInterceptor securityInterceptor(){
    Wss4jSecurityInterceptor wss4jSecurityInterceptor = new Wss4jSecurityInterceptor();
    wss4jSecurityInterceptor.setValidationCallbackHandler(securityCallbackHandler());
    wss4jSecurityInterceptor.setSecurementSamlCallbackHandler(securityCallbackHandler());
    wss4jSecurityInterceptor.setSecurementActions(WSHandlerConstants.USERNAME_TOKEN + " " + WSHandlerConstants.CUSTOM_TOKEN);
    wss4jSecurityInterceptor.setSecurementUsernameTokenCreated(true);
    wss4jSecurityInterceptor.setSecurementPasswordType(WSConstants.PW_TEXT);
    wss4jSecurityInterceptor.setSecurementUsername("dummy");
    wss4jSecurityInterceptor.setSecurementPassword(env.getProperty("soap.auth.password"));
    wss4jSecurityInterceptor.setTimestampPrecisionInMilliseconds(true);
    //wss4jSecurityInterceptor.setSecurementPassword(env.getProperty("soap.auth.password"));
    return wss4jSecurityInterceptor;
}

@Bean
public ClientPasswordCallback pwdCallBack() {
    ClientPasswordCallback pwdCallBack = new ClientPasswordCallback();
    return pwdCallBack;

}

@Bean
public SimplePasswordValidationCallbackHandler securityCallbackHandler(){
    SimplePasswordValidationCallbackHandler callbackHandler = new SimplePasswordValidationCallbackHandler();
    Properties users = new Properties();
    users.setProperty("abc", "abc");
    callbackHandler.setUsers(users);
    return callbackHandler;
}

Я хочу предоставить обработчик обратного вызова пароля в Wss4jSecurityInterceptor.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...