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

getting error while running the spring security app #77

Closed irfanjs closed 3 years ago

irfanjs commented 3 years ago

Hi, have followed all the steps (till 5) . getting below error while running the app . it says , it does not find the keystore file in the exception but I checked the file is present and all application.properties file is also updated

Environment OS : windows 10 Java version : openjdk 11 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

  SolrRepositoriesAutoConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.apache.solr.client.solrj.SolrClient' (OnClassCondition)

   SpringApplicationAdminJmxAutoConfiguration:
      Did not match:
         - @ConditionalOnProperty (spring.application.admin.enabled=true) did not find property 'enabled' (OnPropertyCondition)

   SpringBootWebSecurityConfiguration:
      Did not match:
         - @ConditionalOnMissingBean (types: org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; SearchStrategy: all) found beans of type 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter' appConfiguration (OnBeanCondition)
      Matched:
         - @ConditionalOnClass found required class 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter' (OnClassCondition)
         - found 'session' scope (OnWebApplicationCondition)

   SpringDataWebAutoConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.data.web.PageableHandlerMethodArgumentResolver' (OnClassCondition)

   TaskSchedulingAutoConfiguration#taskScheduler:
      Did not match:
         - @ConditionalOnBean (names: org.springframework.context.annotation.internalScheduledAnnotationProcessor; SearchStrategy: all) did not find any beans named org.springframework.context.annotation.internalScheduledAnnotationProcessor (OnBeanCondition)

   ThymeleafAutoConfiguration.DataAttributeDialectConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'com.github.mxab.thymeleaf.extras.dataattribute.dialect.DataAttributeDialect' (OnClassCondition)

   ThymeleafAutoConfiguration.ThymeleafReactiveConfiguration:
      Did not match:
         - did not find reactive web application classes (OnWebApplicationCondition)

   ThymeleafAutoConfiguration.ThymeleafWebFluxConfiguration:
      Did not match:
         - did not find reactive web application classes (OnWebApplicationCondition)

   ThymeleafAutoConfiguration.ThymeleafWebLayoutConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'nz.net.ultraq.thymeleaf.LayoutDialect' (OnClassCondition)

   ThymeleafAutoConfiguration.ThymeleafWebMvcConfiguration#resourceUrlEncodingFilter:
      Did not match:
         - @ConditionalOnEnabledResourceChain did not find class org.webjars.WebJarAssetLocator (OnEnabledResourceChainCondition)

   TransactionAutoConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.transaction.PlatformTransactionManager' (OnClassCondition)

   WebClientAutoConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.web.reactive.function.client.WebClient' (OnClassCondition)

   WebFluxAutoConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.web.reactive.config.WebFluxConfigurer' (OnClassCondition)

   WebMvcAutoConfiguration.ResourceChainCustomizerConfiguration:
      Did not match:
         - @ConditionalOnEnabledResourceChain did not find class org.webjars.WebJarAssetLocator (OnEnabledResourceChainCondition)

   WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#beanNameViewResolver:
      Did not match:
         - @ConditionalOnMissingBean (types: org.springframework.web.servlet.view.BeanNameViewResolver; SearchStrategy: all) found beans of type 'org.springframework.web.servlet.view.BeanNameViewResolver' beanNameViewResolver (OnBeanCondition)

   WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#localeResolver:
      Did not match:
         - @ConditionalOnProperty (spring.mvc.locale) did not find property 'locale' (OnPropertyCondition)

   WebServiceTemplateAutoConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.oxm.Marshaller' (OnClassCondition)

   WebServicesAutoConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.ws.transport.http.MessageDispatcherServlet' (OnClassCondition)

   WebSocketMessagingAutoConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer' (OnClassCondition)

   WebSocketReactiveAutoConfiguration:
      Did not match:
         - @ConditionalOnWebApplication did not find reactive web application classes (OnWebApplicationCondition)

   WebSocketServletAutoConfiguration.JettyWebSocketConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer' (OnClassCondition)

   WebSocketServletAutoConfiguration.UndertowWebSocketConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'io.undertow.websockets.jsr.Bootstrap' (OnClassCondition)

   XADataSourceAutoConfiguration:
      Did not match:
         - @ConditionalOnClass did not find required class 'javax.transaction.TransactionManager' (OnClassCondition)

Exclusions:
-----------

    None

Unconditional classes:
----------------------

    org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration

    org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration

    org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration

2021-04-26 22:32:58.978 ERROR 5012 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Could not load key store 'classpath:"C:\keystore.p12"'
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at com.microsoft.azure.springsecuritywebapp.SpringSecurityWebAppApplication.main(SpringSecurityWebAppApplication.java:13) ~[classes!/:0.0.1-SNAPSHOT]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[spring-security-web-app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[spring-security-web-app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[spring-security-web-app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[spring-security-web-app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.boot.web.server.WebServerException: Could not load key store 'classpath:"C:\keystore.p12"'
        at org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.configureSslKeyStore(SslConnectorCustomizer.java:128) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.configureSsl(SslConnectorCustomizer.java:88) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.customize(SslConnectorCustomizer.java:57) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.customizeSsl(TomcatServletWebServerFactory.java:321) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.customizeConnector(TomcatServletWebServerFactory.java:305) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:172) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        ... 16 common frames omitted
Caused by: java.io.FileNotFoundException: class path resource ["C:\keystore.p12"] cannot be resolved to URL because it does not exist
        at org.springframework.util.ResourceUtils.getURL(ResourceUtils.java:137) ~[spring-core-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.configureSslKeyStore(SslConnectorCustomizer.java:125) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
        ... 23 common frames omitted

can you please suggest what could be wrong ? please suggest

Avery-Dunn commented 3 years ago

Hello @irfanjs : I believe if you get rid of the classpath keyword in the path to your keystore it should work. classpath specifies the config to look in the resources folder (or maybe just wherever the applications.properties file is), so your Spring config tried to find C:\keystore.p12 in the resources folder.

So, if you have something like server.ssl.key-store=classpath:C:\keystore.p12, try server.ssl.key-store=C:\keystore.p12 instead.

irfanjs commented 3 years ago

Thanks. will do the change and update . what about Java version. Is my Java version OK ?

Avery-Dunn commented 3 years ago

The Java version should be fine. The library is generally built and tested with Java version 8 so there's a chance you could run into a problem, but I've used newer versions of Java without issue.

irfanjs commented 3 years ago

Thanks @Avery-Dunn I removed the classpath and it moved ahead. but now failing with following error :


> 
>       - @ConditionalOnClass did not find required class 'org.springframework.web.reactive.config.WebFluxConfigurer' (OnClassCondition)
> 
>    WebMvcAutoConfiguration.ResourceChainCustomizerConfiguration:
>       Did not match:
>          - @ConditionalOnEnabledResourceChain did not find class org.webjars.WebJarAssetLocator (OnEnabledResourceChainCondition)
> 
>    WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#beanNameViewResolver:
>       Did not match:
>          - @ConditionalOnMissingBean (types: org.springframework.web.servlet.view.BeanNameViewResolver; SearchStrategy: all) found beans of type 'org.springframework.web.servlet.view.BeanNameViewResolver' beanNameViewResolver (OnBeanCondition)
> 
>    WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#localeResolver:
>       Did not match:
>          - @ConditionalOnProperty (spring.mvc.locale) did not find property 'locale' (OnPropertyCondition)
> 
>    WebServiceTemplateAutoConfiguration:
>       Did not match:
>          - @ConditionalOnClass did not find required class 'org.springframework.oxm.Marshaller' (OnClassCondition)
> 
>    WebServicesAutoConfiguration:
>       Did not match:
>          - @ConditionalOnClass did not find required class 'org.springframework.ws.transport.http.MessageDispatcherServlet' (OnClassCondition)
> 
>    WebSocketMessagingAutoConfiguration:
>       Did not match:
>          - @ConditionalOnClass did not find required class 'org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer' (OnClassCondition)
> 
>    WebSocketReactiveAutoConfiguration:
>       Did not match:
>          - @ConditionalOnWebApplication did not find reactive web application classes (OnWebApplicationCondition)
> 
>    WebSocketServletAutoConfiguration.JettyWebSocketConfiguration:
>       Did not match:
>          - @ConditionalOnClass did not find required class 'org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer' (OnClassCondition)
> 
>    WebSocketServletAutoConfiguration.UndertowWebSocketConfiguration:
>       Did not match:
>          - @ConditionalOnClass did not find required class 'io.undertow.websockets.jsr.Bootstrap' (OnClassCondition)
> 
>    XADataSourceAutoConfiguration:
>       Did not match:
>          - @ConditionalOnClass did not find required class 'javax.transaction.TransactionManager' (OnClassCondition)
> 
> 
> Exclusions:
> -----------
> 
>     None
> 
> 
> Unconditional classes:
> ----------------------
> 
>     org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration
> 
>     org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
> 
>     org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration
> 
> 
> 
> 2021-04-27 06:00:41.592 DEBUG 13204 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : Application failed to start due to an exception
> 
> org.springframework.boot.web.embedded.tomcat.ConnectorStartFailedException: Connector configured to listen on port 8445 failed to start
>         at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.checkConnectorHasStarted(TomcatWebServer.java:228) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.checkThatConnectorsHaveStarted(TomcatWebServer.java:220) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:200) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:297) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
>         at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) ~[spring-boot-2.1.8.RELEASE.jar!/:2.1.8.RELEASE]
>         at com.microsoft.azure.springsecuritywebapp.SpringSecurityWebAppApplication.main(SpringSecurityWebAppApplication.java:13) ~[classes!/:0.0.1-SNAPSHOT]
>         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
>         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
>         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
>         at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
>         at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[spring-security-web-app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
>         at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[spring-security-web-app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
>         at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[spring-security-web-app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
>         at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[spring-security-web-app-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
> 
> 2021-04-27 06:00:41.599 ERROR 13204 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :
> 
> ***************************
> APPLICATION FAILED TO START
> ***************************
> 
> Description:
> 
> The Tomcat connector configured to listen on port 8445 failed to start. The port may already be in use or the connector may be misconfigured.
> 
> Action:
> 
> Verify the connector's configuration, identify and stop any process that's listening on port 8445, or configure this application to listen on another port.
> 
> 2021-04-27 06:00:41.600 DEBUG 13204 --- [           main] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1dde4cb2, started on Tue Apr 27 06:00:36 IST 2021
> 2021-04-27 06:00:41.602 DEBUG 13204 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
> 2021-04-27 06:00:41.603  INFO 13204 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

Im sure nothing is running on port 8445 . I checked with command


C:\Users>netstat -ano | find "8445"

C:\Users>

please suggest . Thanks

irfanjs commented 3 years ago

please suggest

Avery-Dunn commented 3 years ago

That's a pretty generic error message from Tomcat, so it's hard to tell what could be wrong. I would suggest double checking your port configuration in the sample and in Tomcat: the sample uses port 8443 as a default in a few places so if you're using 8445 then make sure that's the only port the sample references, and the same with your Tomcat configuration (the server.xml file mainly).

You could just try using a different port, though using 8445 or any other unused port shouldn't be an issue. Also, I got that generic error from Tomcat when trying to reproduce your original issue, because I removed classpath from the config but not classpath: so there was an extra ':' at the start of the keystore's path. Be sure to check for little configure issues like that.

irfanjs commented 3 years ago

Thanks @Avery-Dunn. first of all, I am not using 8445 port . I was getting error so I changed the port to 8445. I reverted back the port to 8443. . Now in application.properties file, I have 8443 port now as default.

Further, I don't find server.xml file . can you tell me the path ?

Avery-Dunn commented 3 years ago

Just to be clear, are you saying that you got the error you posted above when using port 8443, and then tried 8445 and still got the same error? If so, then it's likely a configuration issue somewhere. As I said, double check the applications.properties file to make sure you've put the app id/tenant id/client secret, and the keystore alias/password/type/etc. are all set, there could be some small spelling mistake somewhere.

As for the server.xml file, that's just one of Tomcat's config files, it's not from this sample code. If you're just running the sample through your IDE then whatever embedded Tomcat stuff your IDE has should be fine (I use IntelliJ and haven't need to change any default Tomcat settings there).

However, if you're trying to deploy it to some separate Tomcat server then you'll need to follow the instructions of the Packaging and deploying to container part of the README.

irfanjs commented 3 years ago

OK. let me paste the current application.properties file which I am using. please review . this file has all the app id/tenant id/client secret, and the keystore alias/password/type/


logging.level.org.springframework.*=DEBUG

server.address=localhost
server.port=8443

homePage=https://${server.address}:${server.port}

ssoServiceUrl=https://login.microsoftonline.com/common
endSessionEndpoint=https://login.microsoftonline.com/common/oauth2/v2.0/logout

security.oauth2.client.client-id=4ff92d0e-c3ac-442f-98eb-0ba49cdeca73
security.oauth2.client.client-secret=BMFU1NEO5AL-6Dk6fZNz.JArjvj_.Z363T
security.oauth2.client.scope=openid profile
security.oauth2.client.authentication-scheme=header
security.oauth2.client.client-authentication-scheme=form

security.oauth2.issuer=https://login.microsoftonline.com/96ece526-9c7d-48b0-8daf-8b93c90a5d18/v2.0

security.oauth2.client.access-token-uri=${ssoServiceUrl}/oauth2/v2.0/token
security.oauth2.client.user-authorization-uri=${ssoServiceUrl}/oauth2/v2.0/authorize

security.oauth2.resource.user-info-uri=https://graph.microsoft.com/oidc/userinfo

server.servlet.session.cookie.secure=true

server.ssl.key-store="C:\\keystore.p12"
server.ssl.key-store-password=password
server.ssl.key-store-type=PKCS12
server.ssl.key-alias=testCert
server.ssl.key-password=password

further, I am using the code as it is . Haven't changed anything . Just downloaded from github and built. for building , I am using Maven and just run the command mvn clean package

after building , just executing the built jar file from target folder using command : java -jar spring-security-web-app-0.0.1-SNAPSHOT.jar

please suggest . Thanks

Avery-Dunn commented 3 years ago

Try getting rid of the quotes around the keystore password path, I just tried adding them to my config and got a similar error.

irfanjs commented 3 years ago

Thanks . It worked. now, I'm providing my credentials after clicking on login button. it is redirecting me to the following page ....

image

In the app registration authentication section, this is what I have : image

Is the configuration correct ? Any suggestion please ? Thanks

irfanjs commented 3 years ago

please suggest @Avery-Dunn

Avery-Dunn commented 3 years ago

I'm not sure why you'd be getting a 'no reply address provided' error message, even when I don't put any redirect URLs on that page I get a different error and can't reproduce yours. Did you hit the 'save' button on that authentication section?

One other thing I noticed when trying to reproduce your error is that the redirect URL in the README might have been copied wrong during some changes a while back. Try just using https://localhost:8443/login and no other URLs, the sample is working fine for me when I use that. Also, after saving the new config it may take a few minutes for the Azure side of things to update (it's usually very quick/immediate, but rarely I've seen it take a little longer).

irfanjs commented 3 years ago

Thanks @Avery-Dunn . it moved ahead. this is what now I am getting . so now admin has to approve the request ? Any way to get rid of this message ?

image

Avery-Dunn commented 3 years ago

I haven't seen that specific 'Approval required' screen before, but I'd assume it's something related to the security on your Azure account/tenant. Are you using a personal Azure account, or is your account part of some organization (like a company, school, etc.)?

If your account is part of some organization, then yeah you'd have to get approval from your Azure admin.

If it's a personal account, then you may be able to grant admin consent. In the 'API Permissions' section of the app registration, there should be a 'Grant admin consent' button. Normally that's used for granting tenant-wide consent for certain scopes, but it may solve your problem if you have access to it (it's greyed out for me because I'm not an admin)

image

irfanjs commented 3 years ago

Thanks @Avery-Dunn . I am checking with admin. will keep you posted

Avery-Dunn commented 3 years ago

Closing due to inactivity. If you're still having issues or have any related questions, feel free to re-open or leave comment.