2017-10-12 7 views
0

Ich habe Web-App mit Spring-Sicherheit.Frühling Sicherheit weblogic js Laden

Wenn ich meine App auf tomcat9 laufen funktioniert alles gut, aber wenn ich Oracle Weblogic etwas schief geht und meine js Skripte in App funktioniert nicht.

Weigerte sich, Skript von 'http://localhost:7001/ais/s/lib/datetime/js/moment-with-locales.min.js' auszuführen, da sein MIME-Typ ('application/octet-stream') nicht ausführbar ist und strenge MIME-Typenprüfung aktiviert ist.

das ist meine Sicherheit config:

@Configuration 
@EnableWebSecurity 
public class SecurityConfig extends WebSecurityConfigurerAdapter { 

    @Autowired 
    UserService service; 


    @Override 
    protected void configure(HttpSecurity http) throws Exception { 
     http 
     .authorizeRequests() 
      .antMatchers("/s/**").permitAll() 
      .anyRequest().authenticated() 
      .and() 
     .formLogin() 
      .loginPage("/login") 
      .permitAll() 
      .and() 
     .logout() 
      .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) 
      .permitAll(); 
    } 




    @Override 
    protected void configure(AuthenticationManagerBuilder auth) 
      throws Exception { 
     auth 
     .userDetailsService(new UserDetailServiceImpl(service)); 
    } 
} 
+0

ich für WebLogic glauben an SecurityConfig setzen, Sie einige zusätzliche Konfiguration benötigen. Hattest du einen 'WEB-INF'-Ordner in deinem Projekt? –

+0

@AtaurRahmanMunna Ja, ich habe meine/s/Ordner mit js css,/views/ – Coder

+0

und XML: Dispatcher-Servlet, Web, Weblogic, JDBC, Kacheln – Coder

Antwort

0

Ich löse es nur durch diese

@Override 
public void configure(WebSecurity web) throws Exception { 
    web.ignoring().antMatchers("/s/**"); 
} 
0

hinzufügen weblogic Deployment Descriptor in WEB-INF folder.Build Ihr Projekt und bereitstellen. In meinem Fall sieht meine XML aus. weblogic.xml

<?xml version="1.0" encoding="UTF-8"?> 
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"> 
    <jsp-descriptor> 
    <keepgenerated>true</keepgenerated> 
    <debug>true</debug> 
    </jsp-descriptor> 
    <container-descriptor> 
    <prefer-web-inf-classes>true</prefer-web-inf-classes> 
    </container-descriptor> 
    <context-root>/ContextRootOfYourApp</context-root> 
</weblogic-web-app> 
Verwandte Themen