digst / OIOSAML.Java

Other
11 stars 11 forks source link

Illegal argument exception reading oiosaml.properties file in oiosaml3-3.2.1 version #80

Open ankushbhan55 opened 3 months ago

ankushbhan55 commented 3 months ago

I am trying to implement saml3 with my web application and have managed to initialize DispatcherServlet. Can see the following logs in my server:

2024-08-14 11:17:43,557 DEBUG [dk.gov.oio.saml.servlet.DispatcherServlet] (ServerService Thread Pool -- 100) Initializing DispatcherServlet 2024-08-14 11:17:43,562 DEBUG [dk.gov.oio.saml.service.OIOSAML3Service] (ServerService Thread Pool -- 100) Initializing OIOSAML 2024-08-14 11:17:43,562 DEBUG [dk.gov.oio.saml.service.OIOSAML3Service] (ServerService Thread Pool -- 100) Validating Java Cryptographic Architecture 2024-08-14 11:17:43,563 DEBUG [dk.gov.oio.saml.service.OIOSAML3Service] (ServerService Thread Pool -- 100) Initializing OpenSAML 2024-08-14 11:17:43,563 INFO [org.opensaml.core.config.InitializationService] (ServerService Thread Pool -- 100) Initializing OpenSAML using the Java Services API 2024-08-14 11:17:44,004 INFO [org.opensaml.xmlsec.algorithm.AlgorithmRegistry] (ServerService Thread Pool -- 100) Algorithm failed runtime support check, will not be usable: http://www.w3.org/2001/04/xmlenc#ripemd160 2024-08-14 11:17:44,007 INFO [org.opensaml.xmlsec.algorithm.AlgorithmRegistry] (ServerService Thread Pool -- 100) Algorithm failed runtime support check, will not be usable: http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160 2024-08-14 11:17:44,009 INFO [org.opensaml.xmlsec.algorithm.AlgorithmRegistry] (ServerService Thread Pool -- 100) Algorithm failed runtime support check, will not be usable: http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160 2024-08-14 11:17:44,089 DEBUG [dk.gov.oio.saml.service.OIOSAML3Service] (ServerService Thread Pool -- 100) Setting OIOSAML Configuration 2024-08-14 11:17:44,090 DEBUG [dk.gov.oio.saml.audit.AuditService] (ServerService Thread Pool -- 100) Initialize AuditService 2024-08-14 11:17:44,090 INFO [dk.gov.oio.saml.audit.AuditService] (ServerService Thread Pool -- 100) Initializing AuditLogger 'dk.gov.oio.saml.audit.Slf4JAuditLogger' 2024-08-14 11:17:44,092 INFO [dk.gov.oio.saml.audit.AuditService] (ServerService Thread Pool -- 100) Create 'dk.gov.oio.saml.audit.Slf4JAuditLogger' AuditLogger 2024-08-14 11:17:44,092 INFO [dk.gov.oio.saml.audit.Slf4JAuditLogger] (ServerService Thread Pool -- 100) SLF4J default audit logging adapter created, audit logging must be persisted 6 month! 2024-08-14 11:17:44,093 DEBUG [dk.gov.oio.saml.service.CredentialService] (ServerService Thread Pool -- 100) Configure credential service: 'dk.gov.oio.saml.config.Configuration@6e401070' 2024-08-14 11:17:44,135 DEBUG [dk.gov.oio.saml.session.InternalSessionHandlerFactory] (ServerService Thread Pool -- 100) Configure session handler factory: 'dk.gov.oio.saml.config.Configuration@6e401070' 2024-08-14 11:17:44,135 INFO [dk.gov.oio.saml.session.InternalSessionHandlerFactory] (ServerService Thread Pool -- 100) Create 'dk.gov.oio.saml.session.inmemory.InMemorySessionHandlerFactory' SessionHandlerFactory 2024-08-14 11:17:44,137 DEBUG [dk.gov.oio.saml.service.OIOSAML3Service] (ServerService Thread Pool -- 100) OIOSAML Initialized 2024-08-14 11:17:44,140 DEBUG [dk.gov.oio.saml.servlet.DispatcherServlet] (ServerService Thread Pool -- 100) Initialized DispatcherServlet

However, when I am trying to redirect my request to the AuthenticatedFilter, I am getting a strange error:

2024-08-14 11:18:58,947 DEBUG [dk.gov.oio.saml.filter.AuthenticatedFilter] (default task-2) AuthenticatedFilter invoked by endpoint: '/context-path/saml2/' 2024-08-14 11:18:58,947 DEBUG [dk.gov.oio.saml.filter.AuthenticatedFilter] (default task-2) Unauthenticated session, Required NSIS Level: NONE 2024-08-14 11:18:58,947 DEBUG [dk.gov.oio.saml.filter.AuthenticatedFilter] (default task-2) Filter config: isPassive: false, forceAuthn: false 2024-08-14 11:18:58,948 DEBUG [dk.gov.oio.saml.model.IdPMetadata] (default task-2) MetadataFilePath supplied. Using file based metadata resolver 2024-08-14 11:18:58,949 WARN [dk.gov.oio.saml.filter.AuthenticatedFilter] (default task-2) Unexpected error in authentication filter: java.lang.IllegalArgumentException: URI scheme is not "file" at java.base/java.io.File.(File.java:421) at deployment.as2007.ear.as2007.war//dk.gov.oio.saml.util.ResourceUtil.getResourceAsFile(ResourceUtil.java:42) at deployment.as2007.ear.as2007.war//dk.gov.oio.saml.model.IdPMetadata.initMetadataResolver(IdPMetadata.java:260) at deployment.as2007.ear.as2007.war//dk.gov.oio.saml.model.IdPMetadata.getEntityDescriptor(IdPMetadata.java:70) at deployment.as2007.ear.as2007.war//dk.gov.oio.saml.model.IdPMetadata.(IdPMetadata.java:65) at deployment.as2007.ear.as2007.war//dk.gov.oio.saml.service.IdPMetadataService.getIdPMetadata(IdPMetadataService.java:53) at deployment.as2007.ear.as2007.war//dk.gov.oio.saml.service.IdPMetadataService.getIdPMetadata(IdPMetadataService.java:37) at deployment.as2007.ear.as2007.war//dk.gov.oio.saml.service.AuthnRequestService.getDestination(AuthnRequestService.java:214)

Looks like the code that should read my file as a file:// extension is not reading it correctly. Can you help?

ankushbhan55 commented 3 months ago

So the issue on wildfly is that the ResourceUtil.getClassLoader().getResource(resourceName) would return the file with a vfs: extension. And the class ResourceUtil does not handle it yet