Azure-Samples / ms-identity-java-webapp

A Java web application calling Microsoft graph that is secured using the Microsoft identity platform
MIT License
118 stars 105 forks source link

filter is working in sample app due to which no one can login the app. #42

Closed atifhussain-coder closed 3 years ago

atifhussain-coder commented 4 years ago

I have checked that filter is actually not working because @componentScan is not placed is main class. Due to this filter is not included in the build and program flow is not working as expected.

sangonzal commented 4 years ago

@10pearls-atifhussain Can you share the exact error that you are running into?

atifhussain-coder commented 4 years ago

Hi sangonzal, Basically when i tried to run the sample app after following the guideline in readme file. whenever i tried to go on https://localhost:8080/msal4jsample/secure/aad. its not redirecting me to login screen instead it just showing me that "invalid token". and After debugging the app it i come to know that basically filter in the sample app is actually not compiled because spring boot annotation is not included the main file which i mentioned earlier thats why program flow is not working in expected way. I just included below code in MsalwebSampleApplication.java

`@ServletComponentScan @SpringBootApplication public class MsalWebSampleApplication extends SpringBootServletInitializer {

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

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
    return builder.sources(MsalWebSampleApplication.class);
}

}`

and

` @Override public void destroy() {}

@Override
public void init(FilterConfig arg0) throws ServletException {}`

in AuthFilter.java file. now the program flow is working as expected as explain in the diagram flow. let me know if you want to know more. Thanks

Avery-Dunn commented 3 years ago

Closing due to inactivity and inability to reproduce, and it seems like the fix is there for anyone who runs into the same issue. If there are still issues, feel free to re-open or leave a comment.