Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring or shiro jsonp(AbstractJsonpResponseBodyAdvice) bug [SPR-14967] #19534

Closed
spring-projects-issues opened this issue Dec 1, 2016 · 7 comments
Assignees
Labels
status: declined

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 1, 2016

Say.li opened SPR-14967 and commented

@RestControllerAdvice
public class JsonpAdvice extends AbstractJsonpResponseBodyAdvice {

public JsonpAdvice() {
    super("callback");
}

@Override
protected void beforeBodyWriteInternal(MappingJacksonValue bodyContainer, MediaType contentType, MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response) {
    System.out.println(request.getURI());
    super.beforeBodyWriteInternal(bodyContainer, contentType, returnType, request, response);
}

}

The above method, if there is in the @RequestMapping method
Shiro:
SecurityUtils.getSubject().login(new UsernamePasswordToken("admin", "admin", false)) or
SecurityUtils.getSubject().logout(),
beforeBodyWriteInternal method will not be called,

Normal @RequestMapping method in normal.


No further details from SPR-14967

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 1, 2016

Brian Clozel commented

I don't understand the issue here.
Could you share a small project showing the problem? You can create a repro project of your own or send a PR on spring-framework-issues.
Don't forget to explain what result you were expecting and what you actually get.
Thanks!

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 9, 2016

Say.li commented

Sorry, English is not good.
localhost:8080/login?username=admin&password=admin&callback=a
Expect: a({"status":false,"code":"1001","msg":"没有这个用户","data":null})
Actual:{"status":false,"code":"1001","msg":"没有这个用户","data":null}

AbstractJsonpResponseBodyAdvice. beforeBodyWriteInternal method not implemented,

not used SecurityUtils.getSubject() @RequestMapping expectation and Practice normal.

Don't know is the shrio problem, or spring problem.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 9, 2016

Say.li commented

spring boot 1.4.2.RELEASE
shiro 1.3.2

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 9, 2016

Brian Clozel commented

As far as I understand, Apache Shiro handles requests at its Servlet Filter level.
Spring's JSONP support acts at the Controller handler level (meaning the request has to hit an actual Spring Controller).

If you're looking for JSONP support with Shiro, I'd suggest getting in touch with the Shiro project then.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 9, 2016

Say.li commented

@RequestMapping("logout")
public Result logout(HttpServletResponse response) throws JsonProcessingException {
    SecurityUtils.getSubject().logout();
    Result result = new Result();
    result.setStatus(true);
    result.setCode("0000");
    result.setMsg("退出成功");
    return result;
}

Method is used in the @RequestMapping oh?

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 9, 2016

Say.li commented

Aren't you 4:50 in the morning?

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 9, 2016

Brian Clozel commented

Please create a small project that demonstrates the issue.

@spring-projects-issues spring-projects-issues added type: bug status: declined labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug label Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined
Projects
None yet
Development

No branches or pull requests

2 participants