Spring - All request are going to the same mapping





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I don't know how it happened because I didn't do big changes but now all the request I do to my spring server application are respond by the same service.



My build.gradle (no security at all)



My main (no big deal)



@SpringBootApplication
public class PolifoniaApplication {

public static void main(String args) {
SpringApplication.run(PolifoniaApplication.class, args);
}
}


My Controller (every single request goes to '/login' even from another classes, and I even comment the Mapping line and it keeps going to login). Also even non existing URIs it will go to the "/login" service



@CrossOrigin
@RestController
public class UsuarioController {

Logger logger = LoggerFactory.getLogger(UsuarioController.class);

private static final String ESTUDIANTE_GROUP = "ou=people,dc=springframework,dc=org";
private static final String PROFESOR_GROUP = "ou=otherpeople,dc=springframework,dc=org";
private static final String ADMINISTRATIVO_GROUP = "ou=space cadets,dc=springframework,dc=org";

@Autowired
private LdapTemplate ldapTemplate;

@Autowired
private UsuarioRepository usuarioRepository;

@Autowired
private SesionRepository sesionRepository;

@GetMapping("/all")
public List<String> getAllPersonNames() {
return ldapTemplate.search(query().where("objectclass").is("person"), new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("sn").get().toString();
}
});
}

/**
* Servicio de confirmación de login con LDAP o por token
* @param authData - información de seguridad
* @return String con token si se generó
*/
@PostMapping("/login")
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> autenticar(@RequestBody AuthData authData) {
ResponseEntity<String> response;

boolean correcto = ldapTemplate.authenticate("", String.format("(uid=%s)", authData.getUsername()), authData.getPassword());

if (correcto) {
Usuario usuario = buscarUsuarioLdap(authData);
Sesion sesion = new Sesion(authData, usuario.getId());
response = ResponseEntity.status(HttpStatus.OK).body(Utilities.stringToJson("token", sesion.getToken()));
sesionRepository.save(sesion);
} else {
throw new AuthPolifoniaException();
}

return response;
}

/**
* Método que registra un usuario que ingresa por primera vez a la aplicación
* @param authData - Datos del usuario
*/
private Usuario buscarUsuarioLdap(AuthData authData) {
Usuario usuario = usuarioRepository.findByUsername(authData.getUsername());

if (usuario == null) {
TipoUsuario tipoUsuario = TipoUsuario.ESTUDIANTE;

LdapQuery estudianteQuery = LdapQueryBuilder.query().base(ESTUDIANTE_GROUP).searchScope(SearchScope.SUBTREE)
.filter(new EqualsFilter("uid", authData.getUsername()));

List<String> result = ldapTemplate.search(estudianteQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});

if (result.isEmpty()) {
tipoUsuario = TipoUsuario.PROFESOR;
LdapQuery profesorQuery = LdapQueryBuilder.query().base(PROFESOR_GROUP).searchScope(SearchScope.SUBTREE)
.filter(new EqualsFilter("uid", authData.getUsername()));

result = ldapTemplate.search(profesorQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});
}

if (result.isEmpty()) {
tipoUsuario = TipoUsuario.ADMINISTRATIVO;
LdapQuery administrativoQuery = LdapQueryBuilder.query().base(ADMINISTRATIVO_GROUP)
.searchScope(SearchScope.SUBTREE).filter(new EqualsFilter("uid", authData.getUsername()));
result = ldapTemplate.search(administrativoQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});
}


if (result.isEmpty()) {
tipoUsuario = null;
}

usuario = new Usuario(result.get(0), authData.getUsername(), tipoUsuario);
usuarioRepository.save(usuario);
}
return usuario;
}

/**
* Servicio que destruye el token de sesión
* @param authData - Datos del usuario (token)
*/
@PostMapping("/logout")
public void logout(@RequestHeader(HttpHeaders.WWW_AUTHENTICATE) String token) {
sesionRepository.deleteById(token);
}


And I have an advice that was working. It seems that if I run my tests it works fine. I cannot find any logic involved, it's madness.
And I tried to comment the method but then there is no answer at all by my server.



This is the log since I send the request (in this case "localhost:8080/comunidades", but it happens with all of the services even "/logout")



2018-11-25 10:50:12.981 DEBUG 11840 --- [nio-8080-exec-3] o.a.tomcat.util.net.SocketWrapperBase    : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read from buffer: [0]
2018-11-25 10:50:12.982 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read direct from socket: [301]
2018-11-25 10:50:12.983 DEBUG 11840 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer : Received [GET /comunidades HTTP/1.1
Content-Type: application/json
cache-control: no-cache
Postman-Token: e30db580-fcdd-4c95-8195-f16b9186420a
User-Agent: PostmanRuntime/7.4.0
Accept: */*
Host: localhost:8080
accept-encoding: gzip, deflate
content-length: 17
Connection: keep-alive

{
"pageNum": 1
}]
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] o.a.c.authenticator.AuthenticatorBase : Security checking request GET /comunidades
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] org.apache.catalina.realm.RealmBase : No applicable constraints defined
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] o.a.c.authenticator.AuthenticatorBase : Not subject to any constraint
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.http.Parameters : Set encoding to UTF-8
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : GET "/comunidades", parameters={}
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public org.springframework.http.ResponseEntity<java.lang.String> com.poligran.polifonia.controllers.UsuarioController.autenticar(com.poligran.polifonia.utilities.AuthData)
2018-11-25 10:50:13.000 DEBUG 11840 --- [nio-8080-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2018-11-25 10:50:13.001 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Read "application/json;charset=UTF-8" to [AUTHDATA - User: null, Password: null]
2018-11-25 10:50:13.003 DEBUG 11840 --- [nio-8080-exec-3] o.s.l.c.support.AbstractContextSource : Got Ldap context on server 'ldap://localhost:12345'
2018-11-25 10:50:13.004 INFO 11840 --- [nio-8080-exec-3] o.s.ldap.core.LdapTemplate : No results found for search, base: ''; filter: '(uid=null)'.
2018-11-25 10:50:13.004 DEBUG 11840 --- [nio-8080-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Using @ExceptionHandler com.poligran.polifonia.utilities.ErrorMessage com.poligran.polifonia.advices.AuthAdvice.dataNotFoundHandler(com.poligran.polifonia.exceptions.AuthPolifoniaException)
2018-11-25 10:50:13.005 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/json, application/*+json]
2018-11-25 10:50:13.005 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Writing [com.poligran.polifonia.utilities.ErrorMessage@6fd9c4ca]
2018-11-25 10:50:13.008 WARN 11840 --- [nio-8080-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [com.poligran.polifonia.exceptions.AuthPolifoniaException: Error en la autenticación del usuario]
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.s.orm.jpa.EntityManagerFactoryUtils : Closing JPA EntityManager
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : Completed 401 UNAUTHORIZED
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read from buffer: [0]
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read direct from socket: [0]
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Status in: [OPEN_READ], State out: [OPEN]
2018-11-25 10:50:22.583 DEBUG 11840 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)


Thanks so much for your time.










share|improve this question

























  • ca you share the uri?just wanted to know about the url which you are trying to hit.

    – GauravRai1512
    Nov 25 '18 at 9:03













  • Can you add the log statements during the application start? There are some logs on INFO level indicating which endpoint gets mapped to which controller method and which URL and HTTP methods are mapped

    – rieckpil
    Nov 25 '18 at 10:26











  • I added the log, but I don't see anything except the moment it says, "I received "/comunidades" but I will answer authenticar ("/login")

    – SolidS28
    Nov 25 '18 at 16:15











  • @SolidS28 by looking at your logs it looks like some default authentication is enabled due to which all request to any URL requires to be logged in to access it. Check this link for similar to your problem : stackoverflow.com/questions/45232071/….

    – apandey846
    Nov 25 '18 at 17:11


















0















I don't know how it happened because I didn't do big changes but now all the request I do to my spring server application are respond by the same service.



My build.gradle (no security at all)



My main (no big deal)



@SpringBootApplication
public class PolifoniaApplication {

public static void main(String args) {
SpringApplication.run(PolifoniaApplication.class, args);
}
}


My Controller (every single request goes to '/login' even from another classes, and I even comment the Mapping line and it keeps going to login). Also even non existing URIs it will go to the "/login" service



@CrossOrigin
@RestController
public class UsuarioController {

Logger logger = LoggerFactory.getLogger(UsuarioController.class);

private static final String ESTUDIANTE_GROUP = "ou=people,dc=springframework,dc=org";
private static final String PROFESOR_GROUP = "ou=otherpeople,dc=springframework,dc=org";
private static final String ADMINISTRATIVO_GROUP = "ou=space cadets,dc=springframework,dc=org";

@Autowired
private LdapTemplate ldapTemplate;

@Autowired
private UsuarioRepository usuarioRepository;

@Autowired
private SesionRepository sesionRepository;

@GetMapping("/all")
public List<String> getAllPersonNames() {
return ldapTemplate.search(query().where("objectclass").is("person"), new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("sn").get().toString();
}
});
}

/**
* Servicio de confirmación de login con LDAP o por token
* @param authData - información de seguridad
* @return String con token si se generó
*/
@PostMapping("/login")
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> autenticar(@RequestBody AuthData authData) {
ResponseEntity<String> response;

boolean correcto = ldapTemplate.authenticate("", String.format("(uid=%s)", authData.getUsername()), authData.getPassword());

if (correcto) {
Usuario usuario = buscarUsuarioLdap(authData);
Sesion sesion = new Sesion(authData, usuario.getId());
response = ResponseEntity.status(HttpStatus.OK).body(Utilities.stringToJson("token", sesion.getToken()));
sesionRepository.save(sesion);
} else {
throw new AuthPolifoniaException();
}

return response;
}

/**
* Método que registra un usuario que ingresa por primera vez a la aplicación
* @param authData - Datos del usuario
*/
private Usuario buscarUsuarioLdap(AuthData authData) {
Usuario usuario = usuarioRepository.findByUsername(authData.getUsername());

if (usuario == null) {
TipoUsuario tipoUsuario = TipoUsuario.ESTUDIANTE;

LdapQuery estudianteQuery = LdapQueryBuilder.query().base(ESTUDIANTE_GROUP).searchScope(SearchScope.SUBTREE)
.filter(new EqualsFilter("uid", authData.getUsername()));

List<String> result = ldapTemplate.search(estudianteQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});

if (result.isEmpty()) {
tipoUsuario = TipoUsuario.PROFESOR;
LdapQuery profesorQuery = LdapQueryBuilder.query().base(PROFESOR_GROUP).searchScope(SearchScope.SUBTREE)
.filter(new EqualsFilter("uid", authData.getUsername()));

result = ldapTemplate.search(profesorQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});
}

if (result.isEmpty()) {
tipoUsuario = TipoUsuario.ADMINISTRATIVO;
LdapQuery administrativoQuery = LdapQueryBuilder.query().base(ADMINISTRATIVO_GROUP)
.searchScope(SearchScope.SUBTREE).filter(new EqualsFilter("uid", authData.getUsername()));
result = ldapTemplate.search(administrativoQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});
}


if (result.isEmpty()) {
tipoUsuario = null;
}

usuario = new Usuario(result.get(0), authData.getUsername(), tipoUsuario);
usuarioRepository.save(usuario);
}
return usuario;
}

/**
* Servicio que destruye el token de sesión
* @param authData - Datos del usuario (token)
*/
@PostMapping("/logout")
public void logout(@RequestHeader(HttpHeaders.WWW_AUTHENTICATE) String token) {
sesionRepository.deleteById(token);
}


And I have an advice that was working. It seems that if I run my tests it works fine. I cannot find any logic involved, it's madness.
And I tried to comment the method but then there is no answer at all by my server.



This is the log since I send the request (in this case "localhost:8080/comunidades", but it happens with all of the services even "/logout")



2018-11-25 10:50:12.981 DEBUG 11840 --- [nio-8080-exec-3] o.a.tomcat.util.net.SocketWrapperBase    : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read from buffer: [0]
2018-11-25 10:50:12.982 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read direct from socket: [301]
2018-11-25 10:50:12.983 DEBUG 11840 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer : Received [GET /comunidades HTTP/1.1
Content-Type: application/json
cache-control: no-cache
Postman-Token: e30db580-fcdd-4c95-8195-f16b9186420a
User-Agent: PostmanRuntime/7.4.0
Accept: */*
Host: localhost:8080
accept-encoding: gzip, deflate
content-length: 17
Connection: keep-alive

{
"pageNum": 1
}]
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] o.a.c.authenticator.AuthenticatorBase : Security checking request GET /comunidades
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] org.apache.catalina.realm.RealmBase : No applicable constraints defined
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] o.a.c.authenticator.AuthenticatorBase : Not subject to any constraint
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.http.Parameters : Set encoding to UTF-8
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : GET "/comunidades", parameters={}
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public org.springframework.http.ResponseEntity<java.lang.String> com.poligran.polifonia.controllers.UsuarioController.autenticar(com.poligran.polifonia.utilities.AuthData)
2018-11-25 10:50:13.000 DEBUG 11840 --- [nio-8080-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2018-11-25 10:50:13.001 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Read "application/json;charset=UTF-8" to [AUTHDATA - User: null, Password: null]
2018-11-25 10:50:13.003 DEBUG 11840 --- [nio-8080-exec-3] o.s.l.c.support.AbstractContextSource : Got Ldap context on server 'ldap://localhost:12345'
2018-11-25 10:50:13.004 INFO 11840 --- [nio-8080-exec-3] o.s.ldap.core.LdapTemplate : No results found for search, base: ''; filter: '(uid=null)'.
2018-11-25 10:50:13.004 DEBUG 11840 --- [nio-8080-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Using @ExceptionHandler com.poligran.polifonia.utilities.ErrorMessage com.poligran.polifonia.advices.AuthAdvice.dataNotFoundHandler(com.poligran.polifonia.exceptions.AuthPolifoniaException)
2018-11-25 10:50:13.005 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/json, application/*+json]
2018-11-25 10:50:13.005 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Writing [com.poligran.polifonia.utilities.ErrorMessage@6fd9c4ca]
2018-11-25 10:50:13.008 WARN 11840 --- [nio-8080-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [com.poligran.polifonia.exceptions.AuthPolifoniaException: Error en la autenticación del usuario]
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.s.orm.jpa.EntityManagerFactoryUtils : Closing JPA EntityManager
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : Completed 401 UNAUTHORIZED
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read from buffer: [0]
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read direct from socket: [0]
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Status in: [OPEN_READ], State out: [OPEN]
2018-11-25 10:50:22.583 DEBUG 11840 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)


Thanks so much for your time.










share|improve this question

























  • ca you share the uri?just wanted to know about the url which you are trying to hit.

    – GauravRai1512
    Nov 25 '18 at 9:03













  • Can you add the log statements during the application start? There are some logs on INFO level indicating which endpoint gets mapped to which controller method and which URL and HTTP methods are mapped

    – rieckpil
    Nov 25 '18 at 10:26











  • I added the log, but I don't see anything except the moment it says, "I received "/comunidades" but I will answer authenticar ("/login")

    – SolidS28
    Nov 25 '18 at 16:15











  • @SolidS28 by looking at your logs it looks like some default authentication is enabled due to which all request to any URL requires to be logged in to access it. Check this link for similar to your problem : stackoverflow.com/questions/45232071/….

    – apandey846
    Nov 25 '18 at 17:11














0












0








0








I don't know how it happened because I didn't do big changes but now all the request I do to my spring server application are respond by the same service.



My build.gradle (no security at all)



My main (no big deal)



@SpringBootApplication
public class PolifoniaApplication {

public static void main(String args) {
SpringApplication.run(PolifoniaApplication.class, args);
}
}


My Controller (every single request goes to '/login' even from another classes, and I even comment the Mapping line and it keeps going to login). Also even non existing URIs it will go to the "/login" service



@CrossOrigin
@RestController
public class UsuarioController {

Logger logger = LoggerFactory.getLogger(UsuarioController.class);

private static final String ESTUDIANTE_GROUP = "ou=people,dc=springframework,dc=org";
private static final String PROFESOR_GROUP = "ou=otherpeople,dc=springframework,dc=org";
private static final String ADMINISTRATIVO_GROUP = "ou=space cadets,dc=springframework,dc=org";

@Autowired
private LdapTemplate ldapTemplate;

@Autowired
private UsuarioRepository usuarioRepository;

@Autowired
private SesionRepository sesionRepository;

@GetMapping("/all")
public List<String> getAllPersonNames() {
return ldapTemplate.search(query().where("objectclass").is("person"), new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("sn").get().toString();
}
});
}

/**
* Servicio de confirmación de login con LDAP o por token
* @param authData - información de seguridad
* @return String con token si se generó
*/
@PostMapping("/login")
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> autenticar(@RequestBody AuthData authData) {
ResponseEntity<String> response;

boolean correcto = ldapTemplate.authenticate("", String.format("(uid=%s)", authData.getUsername()), authData.getPassword());

if (correcto) {
Usuario usuario = buscarUsuarioLdap(authData);
Sesion sesion = new Sesion(authData, usuario.getId());
response = ResponseEntity.status(HttpStatus.OK).body(Utilities.stringToJson("token", sesion.getToken()));
sesionRepository.save(sesion);
} else {
throw new AuthPolifoniaException();
}

return response;
}

/**
* Método que registra un usuario que ingresa por primera vez a la aplicación
* @param authData - Datos del usuario
*/
private Usuario buscarUsuarioLdap(AuthData authData) {
Usuario usuario = usuarioRepository.findByUsername(authData.getUsername());

if (usuario == null) {
TipoUsuario tipoUsuario = TipoUsuario.ESTUDIANTE;

LdapQuery estudianteQuery = LdapQueryBuilder.query().base(ESTUDIANTE_GROUP).searchScope(SearchScope.SUBTREE)
.filter(new EqualsFilter("uid", authData.getUsername()));

List<String> result = ldapTemplate.search(estudianteQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});

if (result.isEmpty()) {
tipoUsuario = TipoUsuario.PROFESOR;
LdapQuery profesorQuery = LdapQueryBuilder.query().base(PROFESOR_GROUP).searchScope(SearchScope.SUBTREE)
.filter(new EqualsFilter("uid", authData.getUsername()));

result = ldapTemplate.search(profesorQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});
}

if (result.isEmpty()) {
tipoUsuario = TipoUsuario.ADMINISTRATIVO;
LdapQuery administrativoQuery = LdapQueryBuilder.query().base(ADMINISTRATIVO_GROUP)
.searchScope(SearchScope.SUBTREE).filter(new EqualsFilter("uid", authData.getUsername()));
result = ldapTemplate.search(administrativoQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});
}


if (result.isEmpty()) {
tipoUsuario = null;
}

usuario = new Usuario(result.get(0), authData.getUsername(), tipoUsuario);
usuarioRepository.save(usuario);
}
return usuario;
}

/**
* Servicio que destruye el token de sesión
* @param authData - Datos del usuario (token)
*/
@PostMapping("/logout")
public void logout(@RequestHeader(HttpHeaders.WWW_AUTHENTICATE) String token) {
sesionRepository.deleteById(token);
}


And I have an advice that was working. It seems that if I run my tests it works fine. I cannot find any logic involved, it's madness.
And I tried to comment the method but then there is no answer at all by my server.



This is the log since I send the request (in this case "localhost:8080/comunidades", but it happens with all of the services even "/logout")



2018-11-25 10:50:12.981 DEBUG 11840 --- [nio-8080-exec-3] o.a.tomcat.util.net.SocketWrapperBase    : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read from buffer: [0]
2018-11-25 10:50:12.982 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read direct from socket: [301]
2018-11-25 10:50:12.983 DEBUG 11840 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer : Received [GET /comunidades HTTP/1.1
Content-Type: application/json
cache-control: no-cache
Postman-Token: e30db580-fcdd-4c95-8195-f16b9186420a
User-Agent: PostmanRuntime/7.4.0
Accept: */*
Host: localhost:8080
accept-encoding: gzip, deflate
content-length: 17
Connection: keep-alive

{
"pageNum": 1
}]
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] o.a.c.authenticator.AuthenticatorBase : Security checking request GET /comunidades
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] org.apache.catalina.realm.RealmBase : No applicable constraints defined
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] o.a.c.authenticator.AuthenticatorBase : Not subject to any constraint
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.http.Parameters : Set encoding to UTF-8
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : GET "/comunidades", parameters={}
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public org.springframework.http.ResponseEntity<java.lang.String> com.poligran.polifonia.controllers.UsuarioController.autenticar(com.poligran.polifonia.utilities.AuthData)
2018-11-25 10:50:13.000 DEBUG 11840 --- [nio-8080-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2018-11-25 10:50:13.001 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Read "application/json;charset=UTF-8" to [AUTHDATA - User: null, Password: null]
2018-11-25 10:50:13.003 DEBUG 11840 --- [nio-8080-exec-3] o.s.l.c.support.AbstractContextSource : Got Ldap context on server 'ldap://localhost:12345'
2018-11-25 10:50:13.004 INFO 11840 --- [nio-8080-exec-3] o.s.ldap.core.LdapTemplate : No results found for search, base: ''; filter: '(uid=null)'.
2018-11-25 10:50:13.004 DEBUG 11840 --- [nio-8080-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Using @ExceptionHandler com.poligran.polifonia.utilities.ErrorMessage com.poligran.polifonia.advices.AuthAdvice.dataNotFoundHandler(com.poligran.polifonia.exceptions.AuthPolifoniaException)
2018-11-25 10:50:13.005 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/json, application/*+json]
2018-11-25 10:50:13.005 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Writing [com.poligran.polifonia.utilities.ErrorMessage@6fd9c4ca]
2018-11-25 10:50:13.008 WARN 11840 --- [nio-8080-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [com.poligran.polifonia.exceptions.AuthPolifoniaException: Error en la autenticación del usuario]
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.s.orm.jpa.EntityManagerFactoryUtils : Closing JPA EntityManager
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : Completed 401 UNAUTHORIZED
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read from buffer: [0]
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read direct from socket: [0]
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Status in: [OPEN_READ], State out: [OPEN]
2018-11-25 10:50:22.583 DEBUG 11840 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)


Thanks so much for your time.










share|improve this question
















I don't know how it happened because I didn't do big changes but now all the request I do to my spring server application are respond by the same service.



My build.gradle (no security at all)



My main (no big deal)



@SpringBootApplication
public class PolifoniaApplication {

public static void main(String args) {
SpringApplication.run(PolifoniaApplication.class, args);
}
}


My Controller (every single request goes to '/login' even from another classes, and I even comment the Mapping line and it keeps going to login). Also even non existing URIs it will go to the "/login" service



@CrossOrigin
@RestController
public class UsuarioController {

Logger logger = LoggerFactory.getLogger(UsuarioController.class);

private static final String ESTUDIANTE_GROUP = "ou=people,dc=springframework,dc=org";
private static final String PROFESOR_GROUP = "ou=otherpeople,dc=springframework,dc=org";
private static final String ADMINISTRATIVO_GROUP = "ou=space cadets,dc=springframework,dc=org";

@Autowired
private LdapTemplate ldapTemplate;

@Autowired
private UsuarioRepository usuarioRepository;

@Autowired
private SesionRepository sesionRepository;

@GetMapping("/all")
public List<String> getAllPersonNames() {
return ldapTemplate.search(query().where("objectclass").is("person"), new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("sn").get().toString();
}
});
}

/**
* Servicio de confirmación de login con LDAP o por token
* @param authData - información de seguridad
* @return String con token si se generó
*/
@PostMapping("/login")
@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> autenticar(@RequestBody AuthData authData) {
ResponseEntity<String> response;

boolean correcto = ldapTemplate.authenticate("", String.format("(uid=%s)", authData.getUsername()), authData.getPassword());

if (correcto) {
Usuario usuario = buscarUsuarioLdap(authData);
Sesion sesion = new Sesion(authData, usuario.getId());
response = ResponseEntity.status(HttpStatus.OK).body(Utilities.stringToJson("token", sesion.getToken()));
sesionRepository.save(sesion);
} else {
throw new AuthPolifoniaException();
}

return response;
}

/**
* Método que registra un usuario que ingresa por primera vez a la aplicación
* @param authData - Datos del usuario
*/
private Usuario buscarUsuarioLdap(AuthData authData) {
Usuario usuario = usuarioRepository.findByUsername(authData.getUsername());

if (usuario == null) {
TipoUsuario tipoUsuario = TipoUsuario.ESTUDIANTE;

LdapQuery estudianteQuery = LdapQueryBuilder.query().base(ESTUDIANTE_GROUP).searchScope(SearchScope.SUBTREE)
.filter(new EqualsFilter("uid", authData.getUsername()));

List<String> result = ldapTemplate.search(estudianteQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});

if (result.isEmpty()) {
tipoUsuario = TipoUsuario.PROFESOR;
LdapQuery profesorQuery = LdapQueryBuilder.query().base(PROFESOR_GROUP).searchScope(SearchScope.SUBTREE)
.filter(new EqualsFilter("uid", authData.getUsername()));

result = ldapTemplate.search(profesorQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});
}

if (result.isEmpty()) {
tipoUsuario = TipoUsuario.ADMINISTRATIVO;
LdapQuery administrativoQuery = LdapQueryBuilder.query().base(ADMINISTRATIVO_GROUP)
.searchScope(SearchScope.SUBTREE).filter(new EqualsFilter("uid", authData.getUsername()));
result = ldapTemplate.search(administrativoQuery, new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
return attrs.get("cn").get().toString();
}
});
}


if (result.isEmpty()) {
tipoUsuario = null;
}

usuario = new Usuario(result.get(0), authData.getUsername(), tipoUsuario);
usuarioRepository.save(usuario);
}
return usuario;
}

/**
* Servicio que destruye el token de sesión
* @param authData - Datos del usuario (token)
*/
@PostMapping("/logout")
public void logout(@RequestHeader(HttpHeaders.WWW_AUTHENTICATE) String token) {
sesionRepository.deleteById(token);
}


And I have an advice that was working. It seems that if I run my tests it works fine. I cannot find any logic involved, it's madness.
And I tried to comment the method but then there is no answer at all by my server.



This is the log since I send the request (in this case "localhost:8080/comunidades", but it happens with all of the services even "/logout")



2018-11-25 10:50:12.981 DEBUG 11840 --- [nio-8080-exec-3] o.a.tomcat.util.net.SocketWrapperBase    : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read from buffer: [0]
2018-11-25 10:50:12.982 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read direct from socket: [301]
2018-11-25 10:50:12.983 DEBUG 11840 --- [nio-8080-exec-3] o.a.coyote.http11.Http11InputBuffer : Received [GET /comunidades HTTP/1.1
Content-Type: application/json
cache-control: no-cache
Postman-Token: e30db580-fcdd-4c95-8195-f16b9186420a
User-Agent: PostmanRuntime/7.4.0
Accept: */*
Host: localhost:8080
accept-encoding: gzip, deflate
content-length: 17
Connection: keep-alive

{
"pageNum": 1
}]
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] o.a.c.authenticator.AuthenticatorBase : Security checking request GET /comunidades
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] org.apache.catalina.realm.RealmBase : No applicable constraints defined
2018-11-25 10:50:12.998 DEBUG 11840 --- [nio-8080-exec-3] o.a.c.authenticator.AuthenticatorBase : Not subject to any constraint
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.http.Parameters : Set encoding to UTF-8
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : GET "/comunidades", parameters={}
2018-11-25 10:50:12.999 DEBUG 11840 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public org.springframework.http.ResponseEntity<java.lang.String> com.poligran.polifonia.controllers.UsuarioController.autenticar(com.poligran.polifonia.utilities.AuthData)
2018-11-25 10:50:13.000 DEBUG 11840 --- [nio-8080-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2018-11-25 10:50:13.001 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Read "application/json;charset=UTF-8" to [AUTHDATA - User: null, Password: null]
2018-11-25 10:50:13.003 DEBUG 11840 --- [nio-8080-exec-3] o.s.l.c.support.AbstractContextSource : Got Ldap context on server 'ldap://localhost:12345'
2018-11-25 10:50:13.004 INFO 11840 --- [nio-8080-exec-3] o.s.ldap.core.LdapTemplate : No results found for search, base: ''; filter: '(uid=null)'.
2018-11-25 10:50:13.004 DEBUG 11840 --- [nio-8080-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Using @ExceptionHandler com.poligran.polifonia.utilities.ErrorMessage com.poligran.polifonia.advices.AuthAdvice.dataNotFoundHandler(com.poligran.polifonia.exceptions.AuthPolifoniaException)
2018-11-25 10:50:13.005 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/json, application/*+json]
2018-11-25 10:50:13.005 DEBUG 11840 --- [nio-8080-exec-3] m.m.a.RequestResponseBodyMethodProcessor : Writing [com.poligran.polifonia.utilities.ErrorMessage@6fd9c4ca]
2018-11-25 10:50:13.008 WARN 11840 --- [nio-8080-exec-3] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [com.poligran.polifonia.exceptions.AuthPolifoniaException: Error en la autenticación del usuario]
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.s.orm.jpa.EntityManagerFactoryUtils : Closing JPA EntityManager
2018-11-25 10:50:13.008 DEBUG 11840 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : Completed 401 UNAUTHORIZED
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read from buffer: [0]
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Read direct from socket: [0]
2018-11-25 10:50:13.009 DEBUG 11840 --- [nio-8080-exec-3] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@d601e02:org.apache.tomcat.util.net.NioChannel@75d2ecd0:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:7687]], Status in: [OPEN_READ], State out: [OPEN]
2018-11-25 10:50:22.583 DEBUG 11840 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)


Thanks so much for your time.







java spring rest






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 16:36







SolidS28

















asked Nov 25 '18 at 8:56









SolidS28SolidS28

314




314













  • ca you share the uri?just wanted to know about the url which you are trying to hit.

    – GauravRai1512
    Nov 25 '18 at 9:03













  • Can you add the log statements during the application start? There are some logs on INFO level indicating which endpoint gets mapped to which controller method and which URL and HTTP methods are mapped

    – rieckpil
    Nov 25 '18 at 10:26











  • I added the log, but I don't see anything except the moment it says, "I received "/comunidades" but I will answer authenticar ("/login")

    – SolidS28
    Nov 25 '18 at 16:15











  • @SolidS28 by looking at your logs it looks like some default authentication is enabled due to which all request to any URL requires to be logged in to access it. Check this link for similar to your problem : stackoverflow.com/questions/45232071/….

    – apandey846
    Nov 25 '18 at 17:11



















  • ca you share the uri?just wanted to know about the url which you are trying to hit.

    – GauravRai1512
    Nov 25 '18 at 9:03













  • Can you add the log statements during the application start? There are some logs on INFO level indicating which endpoint gets mapped to which controller method and which URL and HTTP methods are mapped

    – rieckpil
    Nov 25 '18 at 10:26











  • I added the log, but I don't see anything except the moment it says, "I received "/comunidades" but I will answer authenticar ("/login")

    – SolidS28
    Nov 25 '18 at 16:15











  • @SolidS28 by looking at your logs it looks like some default authentication is enabled due to which all request to any URL requires to be logged in to access it. Check this link for similar to your problem : stackoverflow.com/questions/45232071/….

    – apandey846
    Nov 25 '18 at 17:11

















ca you share the uri?just wanted to know about the url which you are trying to hit.

– GauravRai1512
Nov 25 '18 at 9:03







ca you share the uri?just wanted to know about the url which you are trying to hit.

– GauravRai1512
Nov 25 '18 at 9:03















Can you add the log statements during the application start? There are some logs on INFO level indicating which endpoint gets mapped to which controller method and which URL and HTTP methods are mapped

– rieckpil
Nov 25 '18 at 10:26





Can you add the log statements during the application start? There are some logs on INFO level indicating which endpoint gets mapped to which controller method and which URL and HTTP methods are mapped

– rieckpil
Nov 25 '18 at 10:26













I added the log, but I don't see anything except the moment it says, "I received "/comunidades" but I will answer authenticar ("/login")

– SolidS28
Nov 25 '18 at 16:15





I added the log, but I don't see anything except the moment it says, "I received "/comunidades" but I will answer authenticar ("/login")

– SolidS28
Nov 25 '18 at 16:15













@SolidS28 by looking at your logs it looks like some default authentication is enabled due to which all request to any URL requires to be logged in to access it. Check this link for similar to your problem : stackoverflow.com/questions/45232071/….

– apandey846
Nov 25 '18 at 17:11





@SolidS28 by looking at your logs it looks like some default authentication is enabled due to which all request to any URL requires to be logged in to access it. Check this link for similar to your problem : stackoverflow.com/questions/45232071/….

– apandey846
Nov 25 '18 at 17:11












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466003%2fspring-all-request-are-going-to-the-same-mapping%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466003%2fspring-all-request-are-going-to-the-same-mapping%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()