Guest User

Untitled

a guest
Mar 18th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. I receive error 404 erreur each time that i write the right user and password. my spring security configuration is
  2.  
  3. /**
  4. *
  5. */
  6. package org.schoolmind.config;
  7.  
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.context.annotation.Configuration;
  10. import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
  11. import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  12. import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  13. import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  14.  
  15. /**
  16. * @author cedrickiadjeu
  17. *
  18. */
  19. @Configuration
  20. @EnableWebSecurity
  21. public class SecurityConfig extends WebSecurityConfigurerAdapter{
  22.  
  23. @Override
  24. protected void configure(HttpSecurity http) throws Exception {
  25. http.csrf().disable();
  26. http
  27. .authorizeRequests()
  28. .antMatchers( "/schoolmind/index").permitAll()
  29. .antMatchers("/schoolmind/indexAdmin").hasRole("ADMIN")
  30. .and()
  31. .formLogin();
  32. //.loginPage("/login").failureUrl("/login-error");
  33. }
  34.  
  35. @Autowired
  36. public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
  37. auth
  38. .inMemoryAuthentication()
  39. .withUser("user").password("12345").roles("ADMIN");
  40. }
  41.  
  42.  
  43. }
  44. In fact, without spring security, i reach to /schoolmind/indexAdmin without any problem. But when i activate spring security and gives user like login and 12345 like password, spring just redirect me to an 404 error. Please i need your help. excuse my wrong english i'm new in that language
  45.  
  46. I receive error 404 erreur each time that i write the right user and password. my spring security configuration is
  47.  
  48. /**
  49. *
  50. */
  51. package org.schoolmind.config;
  52.  
  53. import org.springframework.beans.factory.annotation.Autowired;
  54. import org.springframework.context.annotation.Configuration;
  55. import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
  56. import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  57. import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  58. import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  59.  
  60. /**
  61. * @author cedrickiadjeu
  62. *
  63. */
  64. @Configuration
  65. @EnableWebSecurity
  66. public class SecurityConfig extends WebSecurityConfigurerAdapter{
  67.  
  68. @Override
  69. protected void configure(HttpSecurity http) throws Exception {
  70. http.csrf().disable();
  71. http
  72. .authorizeRequests()
  73. .antMatchers( "/schoolmind/index").permitAll()
  74. .antMatchers("/schoolmind/indexAdmin").hasRole("ADMIN")
  75. .and()
  76. .formLogin();
  77. //.loginPage("/login").failureUrl("/login-error");
  78. }
  79.  
  80. @Autowired
  81. public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
  82. auth
  83. .inMemoryAuthentication()
  84. .withUser("user").password("12345").roles("ADMIN");
  85. }
  86.  
  87.  
  88. }
  89. In fact, without spring security, i reach to /schoolmind/indexAdmin without any problem. But when i activate spring security and gives user like login and 12345 like password, spring just redirect me to an 404 error. Please i need your help. excuse my wrong english i'm new in that language
  90.  
  91. I receive error 404 erreur each time that i write the right user and password. my spring security configuration is
  92.  
  93. /**
  94. *
  95. */
  96. package org.schoolmind.config;
  97.  
  98. import org.springframework.beans.factory.annotation.Autowired;
  99. import org.springframework.context.annotation.Configuration;
  100. import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
  101. import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  102. import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  103. import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  104.  
  105. /**
  106. * @author cedrickiadjeu
  107. *
  108. */
  109. @Configuration
  110. @EnableWebSecurity
  111. public class SecurityConfig extends WebSecurityConfigurerAdapter{
  112.  
  113. @Override
  114. protected void configure(HttpSecurity http) throws Exception {
  115. http.csrf().disable();
  116. http
  117. .authorizeRequests()
  118. .antMatchers( "/schoolmind/index").permitAll()
  119. .antMatchers("/schoolmind/indexAdmin").hasRole("ADMIN")
  120. .and()
  121. .formLogin();
  122. //.loginPage("/login").failureUrl("/login-error");
  123. }
  124.  
  125. @Autowired
  126. public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
  127. auth
  128. .inMemoryAuthentication()
  129. .withUser("user").password("12345").roles("ADMIN");
  130. }
  131.  
  132.  
  133. }
  134. In fact, without spring security, i reach to /schoolmind/indexAdmin without any problem. But when i activate spring security and gives user like login and 12345 like password, spring just redirect me to an 404 error. Please i need your help. excuse my wrong english i'm new in that language
Add Comment
Please, Sign In to add comment