├── .github └── ISSUE_TEMPLATE │ └── tck_challenge.md ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE.md ├── NOTICE.md ├── README.md ├── api ├── .gitignore ├── pom.xml └── src │ └── main │ ├── java │ ├── jakarta │ │ └── security │ │ │ └── auth │ │ │ └── message │ │ │ ├── AuthException.java │ │ │ ├── AuthStatus.java │ │ │ ├── ClientAuth.java │ │ │ ├── MessageInfo.java │ │ │ ├── MessagePolicy.java │ │ │ ├── ServerAuth.java │ │ │ ├── callback │ │ │ ├── CallerPrincipalCallback.java │ │ │ ├── CertStoreCallback.java │ │ │ ├── GroupPrincipalCallback.java │ │ │ ├── PasswordValidationCallback.java │ │ │ ├── PrivateKeyCallback.java │ │ │ ├── SecretKeyCallback.java │ │ │ ├── TrustStoreCallback.java │ │ │ └── package.html │ │ │ ├── config │ │ │ ├── AuthConfig.java │ │ │ ├── AuthConfigFactory.java │ │ │ ├── AuthConfigProvider.java │ │ │ ├── ClientAuthConfig.java │ │ │ ├── ClientAuthContext.java │ │ │ ├── RegistrationListener.java │ │ │ ├── ServerAuthConfig.java │ │ │ ├── ServerAuthContext.java │ │ │ └── package.html │ │ │ ├── module │ │ │ ├── ClientAuthModule.java │ │ │ ├── ServerAuthModule.java │ │ │ └── package.html │ │ │ └── package.html │ └── module-info.java │ ├── javadoc │ └── doc-files │ │ └── speclicense.html │ └── resources │ └── exclude-common.xml ├── pom.xml ├── spec ├── README.md ├── assembly.xml ├── pom.xml └── src │ ├── main │ ├── asciidoc │ │ ├── authentication-spec.adoc │ │ ├── future-profiles.adoc │ │ ├── images │ │ │ ├── authn-1.png │ │ │ ├── authn-1.svg │ │ │ ├── authn-2.png │ │ │ ├── authn-3.png │ │ │ ├── authn-4.png │ │ │ └── jakarta_ee_logo_schooner_color_stacked_default.png │ │ ├── issues.adoc │ │ ├── license-efsl.adoc │ │ ├── loginmodule-bridge-profile.adoc │ │ ├── message-authentication.adoc │ │ ├── overview.adoc │ │ ├── preface.adoc │ │ ├── related-documents.adoc │ │ ├── revision-history.adoc │ │ ├── servlet-container-profile.adoc │ │ └── soap-profile.adoc │ └── theme │ │ └── jakartaee-theme.yml │ └── theme │ └── jakartaee-theme.yml ├── tck-dist ├── README.md ├── pom.xml ├── src │ └── main │ │ ├── EFTL.txt │ │ └── assembly │ │ └── assembly.xml └── userguide │ ├── README.md │ ├── pom.xml │ └── src │ ├── main │ └── jbake │ │ ├── assets │ │ ├── README.md │ │ ├── _config.yml │ │ ├── css │ │ │ └── style.css │ │ └── img │ │ │ └── eclipse_foundation_logo_tiny.png │ │ ├── content │ │ ├── README │ │ ├── attributes.conf │ │ ├── config.adoc │ │ ├── config.inc │ │ ├── debug-tips.inc │ │ ├── debug.adoc │ │ ├── defns.inc │ │ ├── faq.adoc │ │ ├── install-server-vi.inc │ │ ├── install-server.inc │ │ ├── install.adoc │ │ ├── intro.adoc │ │ ├── intro.inc │ │ ├── packages.inc │ │ ├── platforms.inc │ │ ├── preface.adoc │ │ ├── rebuild.adoc │ │ ├── rebuild.inc │ │ ├── req-software.inc │ │ ├── rules.adoc │ │ ├── rules.inc │ │ ├── tck-packages.inc │ │ ├── title.adoc │ │ ├── title.inc │ │ ├── toc.adoc │ │ ├── using-examples.inc │ │ ├── using.adoc │ │ └── using.inc │ │ ├── jbake.properties │ │ └── templates │ │ ├── footer.ftl │ │ ├── header.ftl │ │ ├── menu.ftl │ │ └── page.ftl │ └── theme │ └── jakartaee-theme.yml └── tck ├── async-authentication ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── ejbasyncauthentication │ │ │ ├── bean │ │ │ └── AsyncBean.java │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ └── AsyncServlet.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── ejbasyncauthentication │ └── AsyncAuthenticationPublicTest.java ├── authentication-signaturegen └── pom.xml ├── authentication-signaturetest ├── pom.xml └── src │ └── test │ ├── java │ └── ee │ │ └── jakarta │ │ └── tck │ │ └── authentication │ │ └── signaturetest │ │ ├── AuthenticationSigTestIT.java │ │ ├── PackageList.java │ │ ├── README │ │ ├── SigTest.java │ │ ├── SigTestData.java │ │ ├── SigTestDriver.java │ │ ├── SigTestEE.java │ │ ├── SigTestResult.java │ │ ├── SignatureTestDriver.java │ │ ├── SignatureTestDriverFactory.java │ │ └── TestUtil.java │ └── resources │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── signaturetest │ ├── jakarta.security.auth.message.sig_3.1.0-SNAPSHOT │ ├── sig-test-pkg-list.txt │ └── sig-test.map ├── basic-authentication ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── basic │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ProtectedServlet.java │ │ │ └── PublicServlet.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── basic │ ├── BasicAuthenticationProtectedTest.java │ ├── BasicAuthenticationPublicTest.java │ └── BasicAuthenticationStatelessTest.java ├── common ├── pom.xml └── src │ └── main │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── common │ ├── ArquillianBase.java │ └── logging │ ├── client │ ├── LogFileProcessor.java │ ├── LogRecordEntry.java │ └── TestUtil.java │ └── server │ ├── TSLogRecord.java │ ├── TSLogger.java │ └── TSXMLFormatter.java ├── custom-principal ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── customprincipal │ │ │ ├── sam │ │ │ ├── MyPrincipal.java │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ProtectedServlet.java │ │ │ └── PublicServlet.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── customprincipal │ ├── CustomPrincipalProtectedTest.java │ ├── CustomPrincipalPublicTest.java │ └── CustomPrincipalStatelessTest.java ├── dispatching-jsf-cdi ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── dispatching │ │ │ ├── bean │ │ │ └── MyBean.java │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ForwardedServlet.java │ │ │ ├── IncludedServlet.java │ │ │ ├── ProtectedServlet.java │ │ │ └── PublicServlet.java │ └── webapp │ │ ├── WEB-INF │ │ ├── beans.xml │ │ ├── faces-config.xml │ │ └── web.xml │ │ ├── forward-cdi.xhtml │ │ ├── forward.xhtml │ │ ├── include-cdi.xhtml │ │ └── include.xhtml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── dispatching │ ├── CDIForwardTest.java │ ├── CDIIncludeTest.java │ ├── JSFCDIForwardTest.java │ ├── JSFCDIIncludeTest.java │ └── JSFForwardTest.java ├── dispatching ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── dispatching │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ForwardedServlet.java │ │ │ ├── IncludedServlet.java │ │ │ ├── ProtectedServlet.java │ │ │ └── PublicServlet.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── dispatching │ ├── BasicForwardTest.java │ └── BasicIncludeTest.java ├── ejb-propagation ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── ejbpropagation │ │ │ ├── ejb │ │ │ ├── ProtectedEJB.java │ │ │ └── PublicEJB.java │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ProtectedServletProtectedEJB.java │ │ │ ├── ProtectedServletPublicEJB.java │ │ │ ├── PublicServletProtectedEJB.java │ │ │ ├── PublicServletPublicEJB.java │ │ │ └── PublicServletPublicEJBLogout.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── ejbpropagation │ ├── ProtectedEJBPropagationTest.java │ ├── PublicEJBPropagationLogoutTest.java │ └── PublicEJBPropagationTest.java ├── ejb-register-session ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── registersession │ │ │ ├── ejb │ │ │ ├── ProtectedEJB.java │ │ │ └── PublicEJB.java │ │ │ ├── sam │ │ │ ├── MyPrincipal.java │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ProtectedServlet.java │ │ │ ├── PublicServlet.java │ │ │ ├── PublicServletProtectedEJB.java │ │ │ └── PublicServletPublicEJB.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── registersession │ ├── RegisterSessionCustomPrincipalEJBPropagationTest.java │ └── RegisterSessionEJBPropagationTest.java ├── invoke-ejb-cdi ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── invoke │ │ │ ├── bean │ │ │ ├── CDIBean.java │ │ │ └── EJBBean.java │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ProtectedServlet.java │ │ │ └── PublicServlet.java │ └── webapp │ │ └── WEB-INF │ │ ├── beans.xml │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── invoke │ ├── InvokeCDIBeanProtectedTest.java │ ├── InvokeCDIBeanPublicTest.java │ ├── InvokeEJBBeanProtectedTest.java │ └── InvokeEJBBeanPublicTest.java ├── jacc-propagation ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── authzpropagation │ │ │ ├── jacc │ │ │ └── JakartaAuthorization.java │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ProtectedServlet.java │ │ │ └── PublicServlet.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── authzpropagation │ ├── AuthzPropagationProtectedTest.java │ └── AuthzPropagationPublicTest.java ├── lifecycle ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── lifecycle │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestLifecycleAuthModule.java │ │ │ └── servlet │ │ │ ├── ProtectedServlet.java │ │ │ └── PublicServlet.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── lifecycle │ ├── AuthModuleMethodInvocationTest.java │ └── IsMandatoryTest.java ├── pom.xml ├── programmatic-authentication ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── programmaticauthentication │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ └── AuthenticateServlet.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── programmaticauthentication │ └── ProgrammaticAuthenticationTest.java ├── register-session ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── registersession │ │ │ ├── sam │ │ │ ├── MyPrincipal.java │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ProtectedServlet.java │ │ │ └── PublicServlet.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── registersession │ ├── RegisterSessionCustomPrincipalTest.java │ └── RegisterSessionTest.java ├── spi ├── JavadocAssertions.html ├── SpecAssertions.html ├── common │ ├── ProviderConfiguration.xml │ ├── pom.xml │ ├── provider-configuration.xsd │ └── src │ │ └── main │ │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── basic │ │ │ ├── sam │ │ │ ├── AuthDataCallbackHandler.java │ │ │ ├── CommonCallbackSupport.java │ │ │ ├── ProviderConfigurationEntry.java │ │ │ ├── ProviderConfigurationXMLFileProcessor.java │ │ │ ├── ServerCallbackSupport.java │ │ │ ├── TSAuthConfigProviderServlet.java │ │ │ ├── TSFileHandler.java │ │ │ ├── config │ │ │ │ ├── SOAPTSServerAuthConfig.java │ │ │ │ ├── TSAuthConfigFactory.java │ │ │ │ ├── TSAuthConfigFactoryForStandalone.java │ │ │ │ ├── TSAuthConfigProvider.java │ │ │ │ ├── TSAuthConfigProviderStandalone.java │ │ │ │ ├── TSClientAuthConfig.java │ │ │ │ ├── TSClientAuthContext.java │ │ │ │ ├── TSRegistrationListener.java │ │ │ │ ├── TSServerAuthConfig.java │ │ │ │ └── TSServerAuthContext.java │ │ │ ├── module │ │ │ │ ├── servlet │ │ │ │ │ ├── TSClientAuthModule.java │ │ │ │ │ ├── TSRequestWrapper.java │ │ │ │ │ ├── TSResponseWrapper.java │ │ │ │ │ ├── TSServerAuthModule.java │ │ │ │ │ └── TSServletWrapperSAM.java │ │ │ │ └── soap │ │ │ │ │ ├── ClientCallbackSupport.java │ │ │ │ │ ├── TSAuthExceptionClientAuthModule.java │ │ │ │ │ ├── TSAuthExceptionServerAuthModule.java │ │ │ │ │ ├── TSClientAuthModule.java │ │ │ │ │ ├── TSFailureClientAuthModule.java │ │ │ │ │ ├── TSFailureServerAuthModule.java │ │ │ │ │ ├── TSSendFailureClientAuthModule.java │ │ │ │ │ ├── TSSendFailureServerAuthModule.java │ │ │ │ │ ├── TSSendSuccessClientAuthModule.java │ │ │ │ │ ├── TSSendSuccessServerAuthModule.java │ │ │ │ │ └── TSServerAuthModule.java │ │ │ └── util │ │ │ │ ├── BASE64Decoder.java │ │ │ │ ├── CEFormatException.java │ │ │ │ ├── CEStreamExhausted.java │ │ │ │ └── CharacterDecoder.java │ │ │ └── servlet │ │ │ ├── CommonTests.java │ │ │ ├── CommonUtils.java │ │ │ ├── IdUtil.java │ │ │ └── JASPICData.java │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ └── jakarta.servlet.ServletContainerInitializer │ │ └── webapp │ │ └── WEB-INF │ │ └── web.xml ├── pom.xml ├── servlet │ ├── auth.conf │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── ee │ │ │ │ └── jakarta │ │ │ │ └── tck │ │ │ │ └── authentication │ │ │ │ └── test │ │ │ │ └── basic │ │ │ │ └── servlet │ │ │ │ ├── ACFTestServlet.java │ │ │ │ ├── AnotherMandatoryAuthen.java │ │ │ │ ├── AuthFactoryContainerInitializer.java │ │ │ │ ├── AuthStatusMandatorySuccess.java │ │ │ │ ├── ModTestServlet.java │ │ │ │ ├── OpenToAllServlet.java │ │ │ │ ├── OptionalAuthen.java │ │ │ │ └── WrapperServlet.java │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── services │ │ │ │ └── jakarta.servlet.ServletContainerInitializer │ │ └── webapp │ │ │ └── WEB-INF │ │ │ └── web.xml │ │ └── test │ │ └── java │ │ └── ee │ │ └── jakarta │ │ └── tck │ │ └── authentication │ │ └── test │ │ └── basic │ │ ├── ServletProfileSPITest.java │ │ └── ServletUnitTest.java └── soap │ ├── auth.conf │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── basic │ │ │ └── soap │ │ │ ├── AuthFactoryContainerInitializer.java │ │ │ ├── Hello.java │ │ │ ├── HelloImpl.java │ │ │ ├── HelloService.java │ │ │ ├── ObjectFactory.java │ │ │ ├── SayHelloProtected.java │ │ │ ├── SayHelloProtectedResponse.java │ │ │ └── package-info.java │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ ├── com.sun.xml.ws.assembler.metro.dev.ClientPipelineHook │ │ │ └── jakarta.servlet.ServletContainerInitializer │ └── webapp │ │ └── WEB-INF │ │ ├── HelloService.wsdl │ │ ├── HelloService_schema1.xsd │ │ ├── soap-web.xml │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── basic │ ├── SoapProfileSPITest.java │ └── SoapUnitTest.java ├── status-codes ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ee │ │ │ └── jakarta │ │ │ └── tck │ │ │ └── authentication │ │ │ └── test │ │ │ └── statuscodes │ │ │ ├── sam │ │ │ ├── SamAutoRegistrationListener.java │ │ │ └── TestServerAuthModule.java │ │ │ └── servlet │ │ │ ├── ProtectedServlet.java │ │ │ └── PublicServlet.java │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── java │ └── ee │ └── jakarta │ └── tck │ └── authentication │ └── test │ └── statuscodes │ ├── ProtectedStatusCodesTest.java │ └── PublicStatusCodesTest.java └── wrapping ├── pom.xml └── src ├── main ├── java │ └── ee │ │ └── jakarta │ │ └── tck │ │ └── authentication │ │ └── test │ │ └── wrapping │ │ ├── sam │ │ ├── SamAutoRegistrationListener.java │ │ └── TestWrappingServerAuthModule.java │ │ └── servlet │ │ ├── DeclaredFilter.java │ │ ├── ProgrammaticFilter.java │ │ ├── ProtectedServlet.java │ │ ├── TestHttpServletRequestWrapper.java │ │ └── TestHttpServletResponseWrapper.java └── webapp │ └── WEB-INF │ └── web.xml └── test └── java └── ee └── jakarta └── tck └── authentication └── test └── wrapping └── WrappingTest.java /.github/ISSUE_TEMPLATE/tck_challenge.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: TCK Challenge 3 | about: Create a TCK Challenge 4 | title: '' 5 | labels: 'challenge' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Challenged tests** 11 | List the challenged tests with the fully qualified classnames and then the test methods, e.g. 12 | ee.jakarta.tck.faces.test.javaee7.multiFieldValidation.Spec1IT#testFailingPreconditionsNotAfterAllInputComponents 13 | 14 | **TCK Version** 15 | Specify the version of the TCK, e.g. Jakarta Faces 4.0.x 16 | 17 | **Description** 18 | A clear and concise description of why you think the tests are wrong. 19 | 20 | **Additional context** 21 | Add any other context about the challenge here. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .classpath 3 | .project 4 | .settings/ 5 | *.iml 6 | *nbactions.xml 7 | .vscode/ 8 | .idea 9 | nb-configuration.xml -------------------------------------------------------------------------------- /NOTICE.md: -------------------------------------------------------------------------------- 1 | # Notices for Jakarta Authentication 2 | 3 | This content is produced and maintained by the Jakarta Authentication 4 | project. 5 | 6 | * Project home: https://projects.eclipse.org/projects/ee4j.jaspic 7 | 8 | ## Trademarks 9 | 10 | Jakarta Authentication is a trademark of the Eclipse Foundation. 11 | 12 | ## Copyright 13 | 14 | All content is the property of the respective authors or their employers. For 15 | more information regarding authorship of content, please consult the listed 16 | source code repository logs. 17 | 18 | ## Declared Project Licenses 19 | 20 | This program and the accompanying materials are made available under the terms 21 | of the Eclipse Public License v. 2.0 which is available at 22 | http://www.eclipse.org/legal/epl-2.0. This Source Code may also be made 23 | available under the following Secondary Licenses when the conditions for such 24 | availability set forth in the Eclipse Public License v. 2.0 are satisfied: GNU 25 | General Public License, version 2 with the GNU Classpath Exception which is 26 | available at https://www.gnu.org/software/classpath/license.html. 27 | 28 | SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 29 | 30 | ## Source Code 31 | 32 | The project maintains the following source code repositories: 33 | 34 | * https://github.com/eclipse-ee4j/jaspic 35 | 36 | ## Third-party Content 37 | 38 | ## Cryptography 39 | 40 | Content may contain encryption software. The country in which you are currently 41 | may have restrictions on the import, possession, and use, and/or re-export to 42 | another country, of encryption software. BEFORE using any encryption software, 43 | please check the country's laws, regulations and policies concerning the import, 44 | possession, or use, and re-export of encryption software, to see if this is 45 | permitted. 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Jakarta Authentication 2 | 3 | This repository contains the code for Jakarta Authentication. 4 | 5 | [Online JavaDoc](https://javadoc.io/doc/jakarta.security.auth.message/jakarta.security.auth.message-api/) 6 | 7 | Building 8 | -------- 9 | 10 | Jakarta Authentication can be built by executing the following from the project root: 11 | 12 | ``mvn clean package`` 13 | 14 | The API jar can then be found in /api/target. 15 | 16 | Making Changes 17 | -------------- 18 | 19 | To make changes, fork this repository, make your changes, and submit a pull request. 20 | 21 | About Jakarta Authentication 22 | ------------- 23 | 24 | Jakarta Authentication defines a general low-level SPI for authentication mechanisms, which are controllers that interact with a caller and a container's environment to obtain the caller's credentials, validate these, and pass an authenticated identity (such as name and groups) to the container. 25 | 26 | Jakarta Authentication consists of several profiles, with each profile telling how a specific container 27 | (such as Jakarta Servlet) can integrate with- and adapt to this SPI. 28 | -------------------------------------------------------------------------------- /api/.gitignore: -------------------------------------------------------------------------------- 1 | /.flattened-pom.xml 2 | -------------------------------------------------------------------------------- /api/src/main/java/jakarta/security/auth/message/callback/CertStoreCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2020 Oracle and/or its affiliates and others. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under the 6 | * terms of the Eclipse Public License v. 2.0, which is available at 7 | * http://www.eclipse.org/legal/epl-2.0. 8 | * 9 | * This Source Code may also be made available under the following Secondary 10 | * Licenses when the conditions for such availability set forth in the 11 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 12 | * version 2 with the GNU Classpath Exception, which is available at 13 | * https://www.gnu.org/software/classpath/license.html. 14 | * 15 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 16 | */ 17 | 18 | package jakarta.security.auth.message.callback; 19 | 20 | import java.security.cert.CertStore; 21 | import javax.security.auth.callback.Callback; 22 | 23 | /** 24 | * Callback for CertStore. 25 | * 26 | *

27 | * A CertStore is a generic repository for certificates. CertStores may be searched to locate public key certificates, 28 | * as well as to put together certificate chains. Such a search may be necessary when the caller needs to verify a 29 | * signature. 30 | * 31 | */ 32 | public class CertStoreCallback implements Callback { 33 | 34 | private CertStore certStore; 35 | 36 | /** 37 | * Used by the CallbackHandler to set the CertStore within the Callback. 38 | * 39 | * @param certStore The certificate store, which may be null 40 | */ 41 | public void setCertStore(CertStore certStore) { 42 | this.certStore = certStore; 43 | } 44 | 45 | /** 46 | * Used by the CertStore user to obtain the CertStore set within the Callback. 47 | * 48 | * @return The CertStore, or null. 49 | */ 50 | public CertStore getCertStore() { 51 | return certStore; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /api/src/main/java/jakarta/security/auth/message/callback/TrustStoreCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997, 2020 Oracle and/or its affiliates and others. 3 | * All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under the 6 | * terms of the Eclipse Public License v. 2.0, which is available at 7 | * http://www.eclipse.org/legal/epl-2.0. 8 | * 9 | * This Source Code may also be made available under the following Secondary 10 | * Licenses when the conditions for such availability set forth in the 11 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 12 | * version 2 with the GNU Classpath Exception, which is available at 13 | * https://www.gnu.org/software/classpath/license.html. 14 | * 15 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 16 | */ 17 | 18 | package jakarta.security.auth.message.callback; 19 | 20 | import java.security.KeyStore; 21 | import javax.security.auth.callback.Callback; 22 | 23 | /** 24 | * Callback for trusted certificate KeyStore. 25 | * 26 | *

27 | * A trusted certificate KeyStore may be used to determine whether a given certificate chain can be trusted. 28 | * 29 | */ 30 | public class TrustStoreCallback implements Callback { 31 | 32 | private KeyStore trustStore; 33 | 34 | /** 35 | * Used by the CallbackHandler to set the trusted certificate keystore within the Callback. 36 | * 37 | * @param trustStore The trusted certificate KeyStore, which must already be loaded. 38 | */ 39 | public void setTrustStore(KeyStore trustStore) { 40 | this.trustStore = trustStore; 41 | } 42 | 43 | /** 44 | * Used by the TrustStore user to obtain the TrustStore set within the Callback. 45 | * 46 | * @return The trusted certificate KeyStore. The KeyStore is guaranteed to already be loaded. 47 | */ 48 | public KeyStore getTrustStore() { 49 | return trustStore; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /api/src/main/java/jakarta/security/auth/message/callback/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | 23 | Jakarta Authentication - Callbacks 24 | 25 | 26 | This package defines callback interfaces that may be used by a pluggable authentication mechanisms (aka message authentication modules) 27 | to interact with the container (aka message processing runtime) that invoked the module. 28 | 29 | 30 | -------------------------------------------------------------------------------- /api/src/main/java/jakarta/security/auth/message/config/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | 23 | Jakarta Authentication - Configuration Interfaces 24 | 25 | 26 | This package defines the interfaces implemented by Jakarta Authentication compatible configuration systems. 27 | 28 | 29 | -------------------------------------------------------------------------------- /api/src/main/java/jakarta/security/auth/message/module/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | 23 | Jakarta Authentication - Authentication Mechanism (Module) Interfaces 24 | 25 | 26 | This package defines the interfaces implemented by Jakarta Authentication compatible authentication mechanisms. 27 | 28 | 29 | -------------------------------------------------------------------------------- /api/src/main/java/jakarta/security/auth/message/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | 23 | Jakarta Authentication 24 | 25 | 26 | This package defines the core interfaces of Jakarta Authentication. 27 | 28 | The SPI defines the interfaces by which pluggable authentication mechanisms (aka message authentication modules) may be configured 29 | and invoked by a container (aka message processing runtimes). 30 | 31 | The term "message" in this context derives from Message Level Security (MLS) vs Transport Level Security (TLS). 32 | 33 | 34 | -------------------------------------------------------------------------------- /api/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | module jakarta.security.auth.message { 17 | exports jakarta.security.auth.message; 18 | exports jakarta.security.auth.message.callback; 19 | exports jakarta.security.auth.message.config; 20 | exports jakarta.security.auth.message.module; 21 | } 22 | -------------------------------------------------------------------------------- /spec/README.md: -------------------------------------------------------------------------------- 1 | Jakarta Authentication Specification 2 | ==================================== 3 | 4 | This project generates the Jakarta Authentication Specification. 5 | 6 | Building 7 | -------- 8 | 9 | Prerequisites: 10 | 11 | * JDK8+ 12 | * Maven 3.0.3+ 13 | 14 | Run the full build: 15 | 16 | `mvn install` 17 | 18 | 19 | Locate the html file: 20 | - target/generated-docs/jakarta-authentication-spec-{project.version}.html 21 | 22 | Locate the PDF file: 23 | - target/generated-docs/jakarta-authentication-spec-{project.version}.pdf 24 | 25 | Locate the zip archive containing both formats of the specification: 26 | - target/authentication-spec-{project.version}.zip 27 | -------------------------------------------------------------------------------- /spec/assembly.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | spec 22 | 23 | zip 24 | 25 | authentication-spec 26 | 27 | 28 | target/generated-docs 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /spec/src/main/asciidoc/authentication-spec.adoc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017, 2019 Contributors to the Eclipse Foundation 3 | // 4 | 5 | = Jakarta Authentication 6 | :authors: Jakarta Authentication Team, https://projects.eclipse.org/projects/ee4j.authentication 7 | :email: https://dev.eclipse.org/mailman/listinfo/jaspic-dev 8 | :version-label!: 9 | :doctype: book 10 | :license: Eclipse Foundation Specification License v1.1 11 | :source-highlighter: coderay 12 | :toc: left 13 | :toclevels: 4 14 | :sectnumlevels: 4 15 | :sectanchors: 16 | :figure-caption: Figure {doc-part}- 17 | :xrefstyle: short 18 | ifdef::backend-pdf[] 19 | :pagenums: 20 | :numbered: 21 | :title-logo-image: image:jakarta_ee_logo_schooner_color_stacked_default.png[pdfwidth=4.25in,align=right] 22 | endif::[] 23 | 24 | // == License 25 | :sectnums!: 26 | include::license-efsl.adoc[] 27 | 28 | // == Toc 29 | :sectnums: 30 | include::preface.adoc[] 31 | 32 | :doc-part: 1 33 | include::overview.adoc[] 34 | 35 | :doc-part: 2 36 | include::message-authentication.adoc[] 37 | 38 | :doc-part: 3 39 | include::servlet-container-profile.adoc[] 40 | 41 | :doc-part: 4 42 | include::soap-profile.adoc[] 43 | 44 | :doc-part: 5 45 | include::future-profiles.adoc[] 46 | 47 | :doc-part: 6 48 | include::loginmodule-bridge-profile.adoc[] 49 | 50 | :doc-part: A 51 | include::related-documents.adoc[] 52 | 53 | :doc-part: B 54 | include::issues.adoc[] 55 | 56 | :doc-part: C 57 | include::revision-history.adoc[] 58 | -------------------------------------------------------------------------------- /spec/src/main/asciidoc/future-profiles.adoc: -------------------------------------------------------------------------------- 1 | [[a666]] 2 | == Future Profiles 3 | 4 | This chapter presents initial thoughts on some other profiles that are being considered. 5 | 6 | === JMS Profile 7 | 8 | This profile would use the interfaces defined 9 | in this specification to apply pluggable security mechanisms to JMS 10 | message exchanges. 11 | 12 | ==== Message Abstraction 13 | 14 | This profile would employ `jakarta.jms.Message` 15 | as its message abstraction. Properties would be set on the Message to 16 | convey security credentials and security results. 17 | 18 | ==== Destinations 19 | 20 | In this profile, application contexts could 21 | be defined for JMS destinations, such that authentication configuration 22 | providers could be registered for interactions with destinations, and 23 | such that authentication context configuration objects could be defined 24 | for interactions with destinations. 25 | 26 | ==== Message Processing Model 27 | 28 | A client profile could require that 29 | `secureRequest` be called when a Message is sent by a MessageProducer to a 30 | Destination and that validateResponse be called when a Message is 31 | received by a MessageConsumer from a Destination. 32 | 33 | A server profile could require that 34 | validateRequest be called when a Destination receives a message from a 35 | MessageProducer, and that secureResponse be called when a Destination 36 | sends a message to a MessageConsumer. 37 | 38 | [[a677]] 39 | === RMI/IIOP Portable Interceptor Profile 40 | 41 | This profile would be implemented within 42 | portable interceptors, where it could be used secure RMI/IIOP message 43 | exchanges and to serve as security mechanism integration facility within 44 | the portable interceptor processing framework. 45 | 46 | === Message Abstraction 47 | 48 | The profile would employ 49 | `org.omg.PortableInterceptor.ClientRequestInfo` for its client-side 50 | message abstraction, and `org.omg.PortableInterceptor.ServerRequestInfo` 51 | for its server-side message abstraction. -------------------------------------------------------------------------------- /spec/src/main/asciidoc/images/authn-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/spec/src/main/asciidoc/images/authn-1.png -------------------------------------------------------------------------------- /spec/src/main/asciidoc/images/authn-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/spec/src/main/asciidoc/images/authn-2.png -------------------------------------------------------------------------------- /spec/src/main/asciidoc/images/authn-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/spec/src/main/asciidoc/images/authn-3.png -------------------------------------------------------------------------------- /spec/src/main/asciidoc/images/authn-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/spec/src/main/asciidoc/images/authn-4.png -------------------------------------------------------------------------------- /spec/src/main/asciidoc/images/jakarta_ee_logo_schooner_color_stacked_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/spec/src/main/asciidoc/images/jakarta_ee_logo_schooner_color_stacked_default.png -------------------------------------------------------------------------------- /spec/src/main/asciidoc/related-documents.adoc: -------------------------------------------------------------------------------- 1 | [appendix] 2 | == Related Documents 3 | 4 | This specification refers to the following documents. The terms used to refer to the documents in this 5 | specification are included in brackets. 6 | 7 | _S. Bradner, “Key words for use in RFCs to Indicate Requirement Levels,” RFC 2119, Harvard University, March 1997, [Keywords]_ 8 | 9 | _Jakarta EE 9 Specification_ [Jakarta EE 9 Specification], available at: 10 | https://github.com/eclipse-ee4j/jakartaee-platform 11 | 12 | _Jakarta Servlet Specification, Version 5.0 [Jakarta Servlet Specification], available at: https://github.com/eclipse-ee4j/servlet-api_ 13 | 14 | _Jakarta XML Web Services 3.0 [Jakarta XML Web Services Specification], available at: https://github.com/eclipse-ee4j/jax-ws-api_ 15 | 16 | _Jakarta Messaging Specification Version 3.0 [Jakarta Messaging Specification], available at: https://github.com/eclipse-ee4j/jms-api_ 17 | 18 | Jakarta Enterprise Beans, Version 4.0_ [Jakarta Enterprise Beans Specification], available at: _https://github.com/eclipse-ee4j/ejb-api_ 19 | 20 | _Java™, Standard Edition, Version 8.0 API Specification [Java SE 8 Specification], available at: https://docs.oracle.com/javase/8/docs/api_ 21 | 22 | _Java™ Authentication and Authorization Service_ (JAAS) [JAAS Specification], available at: https://docs.oracle.com/javase/8/docs/technotes/guides/security/jaas/JAASRefGuide.html_ 23 | 24 | _SOAP Version 1.2 Part 0: Primer, W3C Recommendation, 24 June 2003 [SOAP Specification], available at: http://www.w3.org/TR/soap12-part0_ 25 | 26 | _Common Secure Interoperability, Version 2 (CSIv2),OMG standard [CSIv2 Specification], available at: http://www.omg.org/technology/documents/formal/omg_security.htm_ 27 | 28 | _Portable Interceptors, OMG Standard [PI Specification], available at: https://omg.org/spec/CORBA/3.3/Interfaces/PDF_ -------------------------------------------------------------------------------- /tck-dist/README.md: -------------------------------------------------------------------------------- 1 | # Jakarta Authentication TCK Distribution 2 | 3 | This bundle contains the Jakarta Authentication TCK. The contents of this bundle are: 4 | - tck/* - the TCK tests src and pom.xml runner profiles 5 | - docs/* - the TCK user guide (HTML and PDF) 6 | - README.md - this README 7 | - LICENSE - the EFTL license terms 8 | -------------------------------------------------------------------------------- /tck-dist/userguide/README.md: -------------------------------------------------------------------------------- 1 | # A JBake project template 2 | 3 | ## About JBake 4 | 5 | JBake is a static site generator, it's inspired from jekyll and written 6 | in java. The basic idea is to have templates for the structure of the 7 | page, and the body generated from asciidoc content. 8 | 9 | ## Pre requisites 10 | 11 | - Maven 12 | - JDK8+ 13 | 14 | Deploying to Github will require password less authentication. 15 | 16 | This is done by exporting your SSH public key into your Github account. 17 | 18 | ## Build the site locally 19 | 20 | The site is generated under target/staging. 21 | 22 | Open file:///PATH_TO_PROJECT_DIR/target/staging in a browser to view the site. 23 | 24 | ``` 25 | mvn generate-resources 26 | ``` 27 | 28 | Or you can invoke the JBake plugin directly. 29 | 30 | ``` 31 | mvn jbake:build 32 | ``` 33 | 34 | ### Rebuild the site on changes 35 | 36 | ``` 37 | mvn jbake:watch 38 | ``` 39 | 40 | If you keep this command running, changes to the sources will be 41 | detected and the site will be rendered incrementally. 42 | 43 | This is convenient when writing content. 44 | 45 | ### Serve the site locally 46 | 47 | ``` 48 | mvn jbake:serve 49 | ``` 50 | 51 | If a webserver is required (e.g. absolute path are used), this command 52 | will start a webserver (jetty) at http://localhost:8820. It will also 53 | watch for changes and rebuild incrementally. 54 | 55 | ## Deploy the site to Github Pages 56 | 57 | ``` 58 | mvn deploy 59 | ``` 60 | 61 | ## Produce a zip file for download 62 | 63 | To produce a zip file containing the generated html files, use: 64 | 65 | ``` 66 | mvn package 67 | ``` 68 | 69 | When making a release on GitHub, this zip file should be added to the release. 70 | 71 | ## Links 72 | 73 | - [JBake maven plugin documentation](https://github.com/Blazebit/jbake-maven-plugin) 74 | - [JBake documentation](http://jbake.org/docs/2.5.1) 75 | - [Freemarker documentation](http://freemarker.org/docs) 76 | - [AsciiDoc User Guide](http://asciidoc.org/userguide.html) 77 | - [Asciidoctor quick reference](http://asciidoctor.org/docs/asciidoc-syntax-quick-reference) 78 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/assets/README.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | The {{site.title}} project contains the [AsciiDoc](http://asciidoc.org/) 4 | source code for the ... 5 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/assets/_config.yml: -------------------------------------------------------------------------------- 1 | remote_theme: jakartaee/jekyll-theme-jakarta-ee 2 | 3 | title: [tck_jaspic_v1_1] 4 | description: [Oracle Technology Compatibility Kit User's Guide for Java Authentication SPI for Containers (JASPIC) 3.0 for Technology Licensees, Release 3.0] 5 | 6 | # sidebar links url 7 | links: 8 | source: https://github.com/javaee/tck_jaspic_v1_1 9 | download: https://github.com/javaee/tck_jaspic_v1_1/releases 10 | #mailinglist: https://javaee.groups.io/g/tck_jaspic_v1_1 11 | #javadocs: 12 | docs: https://javaee.github.io/tck_jaspic_v1_1 13 | #faq: 14 | 15 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/assets/img/eclipse_foundation_logo_tiny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/tck-dist/userguide/src/main/jbake/assets/img/eclipse_foundation_logo_tiny.png -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/attributes.conf: -------------------------------------------------------------------------------- 1 | :TechnologyFullName: Jakarta Authentication 2 | :TechnologyShortName: Authentication 3 | :LegacyAcronym: JASPIC 4 | :TechnologyVersion: 3.1 5 | :ReleaseDate: June 2024 6 | :CopyrightDates: 2017, 2024 7 | :TechnologyRI: Eclipse GlassFish 8.0 8 | :TechnologyRIURL: https://projects.eclipse.org/projects/ee4j.glassfish 9 | :SpecificationURL: https://jakarta.ee/specifications/authentication/3.1/ 10 | :TCKInquiryList: mailto:jaspic-dev@eclipse.org[jaspic-dev@eclipse.org] 11 | :SpecificationInquiryList: mailto:jaspic-dev@eclipse.org[jaspic-dev@eclipse.org] 12 | :techID: Authentication 13 | // Define this attribute (uncomment it) if the TCK includes no API tests. (Rare.) 14 | // :no-api-tests: 15 | // Define this attribute (uncomment it) if the TCK includes end-to-end tests. 16 | // :end-to-end-tests: 17 | // Define this attribute (uncomment it) if subsets of the API are allowed. 18 | // (Common Annotations only) 19 | // :subset-allowed: 20 | // 21 | // The environment variable used to specify the home directory 22 | // for the technology. Used in config.inc. 23 | :TechnologyHomeEnv: JASPIC_HOME 24 | // Java SE version required. 25 | :SEversion: 11 26 | :MavenVersion: 3.8.6+ 27 | :JakartaEEVersion: 11.0 28 | :JUnitTestVersion: 4.13.2 29 | :TCKPackageName: jakarta-authentication-tck-3.1.0.zip 30 | // Directory names used in examples in using.adoc. 31 | //:singleTestDirectoryExample: /src/com/sun/ts/tests/jaspic 32 | //:subsetTestDirectoryExample: /src/com/sun/ts/tests/jaspic 33 | // Define this attribute (uncomment it) if the TCK needs the rebuild appendix. 34 | // :rebuild: 35 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/config.adoc: -------------------------------------------------------------------------------- 1 | type=page 2 | status=published 3 | title=Setup and Configuration 4 | next=using.html 5 | prev=install.html 6 | ~~~~~~ 7 | include::attributes.conf[] 8 | Setup and Configuration 9 | ======================= 10 | 11 | [[GBFVV]] 12 | 13 | 14 | 15 | [[setup-and-configuration]] 16 | 4 Setup and Configuration 17 | ------------------------- 18 | 19 | 20 | [NOTE] 21 | ==== 22 | The Jakarta EE Specification process provides for any number of compatible implementations. 23 | As additional implementations become available, refer to project or product documentation from 24 | those vendors for specific TCK setup and operational guidance. 25 | 26 | ==== 27 | 28 | This chapter describes how to set up the {TechnologyShortName} TCK. 29 | Before proceeding with the instructions in 30 | this chapter, be sure to install all required software, as described in 31 | link:install.html#GBFTP[Chapter 3, "Installation."] 32 | 33 | After completing the instructions in this chapter, proceed to 34 | link:using.html#GBFWO[Chapter 5, "Executing Tests,"] for instructions on 35 | running the {TechnologyShortName} TCK. 36 | 37 | include::config.inc[] 38 | 39 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/debug-tips.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/tck-dist/userguide/src/main/jbake/content/debug-tips.inc -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/debug.adoc: -------------------------------------------------------------------------------- 1 | type=page 2 | status=published 3 | title=Debugging Test Problems 4 | next=faq.html 5 | prev=using.html 6 | ~~~~~~ 7 | include::attributes.conf[] 8 | Debugging Test Problems 9 | ======================= 10 | 11 | [[GBFUV]] 12 | 13 | 14 | [[debugging-test-problems]] 15 | 6 Debugging Test Problems 16 | ------------------------- 17 | 18 | There are a number of reasons that tests can fail to execute properly. 19 | This chapter provides some approaches for dealing with these failures. 20 | 21 | This chapter includes the following topics: 22 | 23 | * link:#GBFYP[Overview] 24 | * link:#GBFVF[Test Tree] 25 | * link:#GBFWI[Folder Information] 26 | * link:#GBFVP[Test Information] 27 | * link:#GBFVZ[Report Files] 28 | * link:#GBFYF[Configuration Failures] 29 | 30 | [[GBFYP]][[overview]] 31 | 32 | 6.1 Overview 33 | ~~~~~~~~~~~~ 34 | 35 | The goal of a test run is for all tests in the test suite that are not 36 | filtered out to have passing results. If the root test suite folder 37 | contains tests with errors or failing results, you must troubleshoot and 38 | correct the cause to satisfactorily complete the test run. 39 | 40 | 41 | If a large number of tests failed, you should read 42 | link:#GBFYF[Configuration Failures] to see if a 43 | configuration issue is the cause of the failures. 44 | 45 | 46 | [[GBFYF]][[configuration-failures]] 47 | 48 | 6.2 Configuration Failures 49 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 50 | 51 | Configuration failures are easily recognized because many tests fail the 52 | same way. When all your tests begin to fail, you may want to stop the 53 | run immediately and start viewing individual test output. 54 | 55 | include::debug-tips.inc[] 56 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/defns.inc: -------------------------------------------------------------------------------- 1 | // NOTE TO WRITERS: 2 | // Most technologies will only need the compatibility rules in rules.adoc. 3 | // Some technologies will need additional definitions to go with additional 4 | // rules. If they're needed, remove the comment characters below 5 | // and update the definitions as appropriate. 6 | // 7 | // The first block below is additional definitions needed by 8 | // Jakarta XML Web Services. 9 | // 10 | // The second block below is additional defintions needed by 11 | // Jakarta Server Pages. 12 | // 13 | // NOTE: This set of examples is NOT complete, but should be. 14 | // 15 | // 16 | // Jakarta XML Web Services 17 | // 18 | // |Development Kit |A software product that implements or incorporates a 19 | // Compiler, a Schema Compiler, a Schema Generator, a Java-to-WSDL Tool, a 20 | // WSDL-to-Java Tool, and/or an RMI Compiler. 21 | // 22 | // |Java-to-WSDL Output |Output of a Java-to-WSDL Tool that is required for 23 | // Web service deployment and invocation. 24 | // 25 | // |Java-to-WSDL Tool |A software development tool that implements or 26 | // incorporates a function that generates web service endpoint descriptions 27 | // in WSDL and XML schema format from Source Code as specified by the 28 | // Jakarta XML Web Services Specification. 29 | // 30 | // |WSDL-to-Java Output |Output of a WSDL-to-Java tool that is required for 31 | // Web service deployment and invocation. 32 | // 33 | // |WSDL-to-Java Tool |A software development tool that implements or 34 | // incorporates a function that generates web service interfaces for 35 | // clients and endpoints from a WSDL description as specified by the 36 | // Jakarta XML Web Services Specification. 37 | // 38 | // 39 | // Jakarta Server Pages 40 | // 41 | // |Jakarta Server Page |A text-based document that uses Jakarta Server 42 | // Pages technology. 43 | // 44 | // |Jakarta Server Page Implementation Class |A program constructed by 45 | // transforming the Jakarta Server Page text into a Java language program 46 | // using the transformation rules described in the Specifications. 47 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/faq.adoc: -------------------------------------------------------------------------------- 1 | type=page 2 | status=published 3 | title=Appendix A: Frequently Asked Questions 4 | next=rebuild.html 5 | prev=debug.html 6 | ~~~~~~ 7 | include::attributes.conf[] 8 | Appendix A: Frequently Asked Questions 9 | ====================================== 10 | 11 | [[GBFYD]] 12 | 13 | 14 | [[a-frequently-asked-questions]] 15 | A Frequently Asked Questions 16 | ---------------------------- 17 | 18 | This appendix contains the following questions. 19 | 20 | * link:#GBFYQ[Where do I start to debug a test failure?] 21 | * link:#GBFWU[What would cause tests be added to the exclude list?] 22 | 23 | [[GBFYQ]][[a.1-where-do-i-start-to-debug-a-test-failure]] 24 | 25 | A.1 Where do I start to debug a test failure? 26 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 | 28 | The Maven Surefire Plugin used to run the TCK tests, describes how to run the plugin under a debugger: 29 | https://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html 30 | 31 | 32 | [[GBFWU]][[a.2-what-would-cause-tests-be-added-to-the-exclude-list]] 33 | 34 | A.2 What would cause tests be added to the exclude list? 35 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 36 | 37 | The following is a list of reasons for a test to be 38 | included in the Exclude List: 39 | 40 | * An error in a Compatible Implementation that does not allow the test to 41 | execute properly has been discovered. 42 | * An error in the specification that was used as the basis of the test 43 | has been discovered. 44 | * An error in the test has been discovered. 45 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/install-server-vi.inc: -------------------------------------------------------------------------------- 1 | . Install a Web server on which the {TechnologyShortName} TCK test 2 | applications can be published for testing the VI. 3 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/install-server.inc: -------------------------------------------------------------------------------- 1 | . Install the Jakarta EE {JakartaEEVersion} CI software (the servlet Web container used 2 | for running the {TechnologyShortName} TCK with the 3 | {TechnologyShortName} {TechnologyVersion} CI), if it is not already 4 | installed. + 5 | Download and install the Servlet Web container with the 6 | {TechnologyShortName} {TechnologyVersion} CI used for running the 7 | {TechnologyShortName} TCK {TechnologyVersion}, represented by the Jakarta 8 | EE {JakartaEEVersion} CI. 9 | One CI is {TechnologyRI}. 10 | You may obtain a copy of this CI by downloading it from {TechnologyRIURL}. -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/packages.inc: -------------------------------------------------------------------------------- 1 | ** `jakarta.security.auth.message` 2 | 3 | ** `jakarta.security.auth.message.callback` 4 | 5 | ** `jakarta.security.auth.message.config` 6 | 7 | ** `jakarta.security.auth.message.module` 8 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/platforms.inc: -------------------------------------------------------------------------------- 1 | * CentOS Linux 7 2 | * Alpine Linux v3.12 -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/rebuild.adoc: -------------------------------------------------------------------------------- 1 | type=page 2 | status=published 3 | title=Appendix B: Rebuild Rules 4 | prev=faq.html 5 | ~~~~~~ 6 | include::attributes.conf[] 7 | 8 | Appendix B: Rebuild Rules 9 | ========================= 10 | 11 | 12 | ifdef::rebuild[] 13 | include::rebuild.inc[] 14 | endif::rebuild[] 15 | ifndef::rebuild[] 16 | 17 | <<< 18 | Appendix B is not used for the {TechnologyShortName} TCK. 19 | 20 | endif::rebuild[] 21 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/rebuild.inc: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////// 2 | NOTE TO WRITERS: 3 | The following sections should be customized for the technology. 4 | See JAXRS for an example of this include file. 5 | /////////////////////////////////////////////////////////////////////// 6 | 7 | [[GCLIZ]] 8 | 9 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/req-software.inc: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////// 2 | NOTE TO WRITERS: 3 | This is a list of software required in addition to the TCK and the Compatible Implementation. 4 | For many Jakarta EE APIs, the Jakarta EE RI will be required, as described below. 5 | For standalone technologies, no other software may be required, and the 6 | below line can be removed. 7 | 8 | This is used in intro.adoc in section 1.3 and install.adoc in section 3.2. 9 | /////////////////////////////////////////////////////////////////////// 10 | 11 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/tck-packages.inc: -------------------------------------------------------------------------------- 1 | ** JDOM 1.1.3 2 | 3 | ** Apache Commons HTTP Client 3.1 4 | 5 | ** Apache Commons Logging 1.1.3 6 | 7 | ** Apache Commons Codec 1.9 8 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/title.adoc: -------------------------------------------------------------------------------- 1 | type=page 2 | status=published 3 | title=TCK User's Guide for Technology Implementors 4 | next=preface.html 5 | prev=toc.html 6 | ~~~~~~ 7 | include::attributes.conf[] 8 | 9 | TCK User's Guide for {TechnologyFullName}, Release {TechnologyVersion} for Jakarta EE 10 | ===================================================================================== 11 | 12 | [[eclipse-foundation]] 13 | Eclipse Foundation 14 | ------------------ 15 | 16 | Technology Compatibility Kit User's Guide for {TechnologyFullName} 17 | 18 | Release {TechnologyVersion} for Jakarta EE 19 | 20 | {ReleaseDate} 21 | 22 | [[sthref1]] 23 | 24 | ''''' 25 | 26 | Technology Compatibility Kit User's Guide for {TechnologyFullName}, 27 | Release {TechnologyVersion} for Jakarta EE 28 | 29 | Copyright © {CopyrightDates} Oracle and/or its affiliates. All rights reserved. 30 | 31 | This program and the accompanying materials are made available under 32 | the terms of the Eclipse Public License v. 2.0, which is available at 33 | http://www.eclipse.org/legal/epl-2.0. 34 | 35 | SPDX-License-Identifier: EPL-2.0 36 | 37 | Oracle and Java are registered trademarks of Oracle and/or its 38 | affiliates. Other names may be trademarks of their respective owners. 39 | 40 | include::title.inc[] 41 | 42 | 43 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/title.inc: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////// 2 | NOTE TO WRITERS: 3 | This is included at the tail end of the Title page. 4 | The following section should be customized for the technology. 5 | This is provided to allow each technology to customize legacy acronym names 6 | that are used in this TCK. 7 | Be sure to customize LegacyAcronym in attributes.conf 8 | Add additional lines as needed for acronyms found in your TCK user guide. 9 | /////////////////////////////////////////////////////////////////////// 10 | 11 | References in this document to {LegacyAcronym} refer to the {TechnologyFullName}, unless otherwise noted. 12 | 13 | References in this document to JWS refer to Jakarta Web Services Metadata, unless otherwise noted. 14 | 15 | Reference in this document to SAAJ refer to Jakarta SOAP Attachments, unless otherwise noted. 16 | 17 | References in this document to JAXWS refer to Jakarta XML Web Services, unless otherwise noted. 18 | 19 | References in this document to JACC refer to Jakarta Authorization, unless otherwise noted. 20 | 21 | 22 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/using-examples.inc: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////// 2 | NOTE TO WRITERS: 3 | These CLI examples can be customized as necessary. 4 | /////////////////////////////////////////////////////////////////////// 5 | 6 | To run all tests against GlassFish, use following command: + 7 | [source,oac_no_warn] 8 | ---- 9 | mvn -Pglassfish-ci-managed clean test surefire-report:report 10 | ---- 11 | This will produce a target/site/surefire-report.html summary. Replace the glassfish-ci-managed profile name with the 12 | name of any other configured compatible implementation to run the tests against that implementation. 13 | 14 | When doing testing with staged dependencies, you may need to add the -Pstaging profile: 15 | ---- 16 | mvn -Pstaging -Pglassfish-ci-managed clean test surefire-report:report 17 | ---- 18 | 19 | When running tests against Jakarta EE Compatible Implementation you need to specify the `-Pplatform` profile: 20 | This will set the `KEYWORDS` parameter accordingly for choosing the tests to be run for Platform mode (Full profile in default). 21 | ---- 22 | mvn -Pplatform clean test surefire-report:report 23 | ---- 24 | 25 | When running tests against Jakarta EE Web Profile Compatible Implementation you need to specify the `-Pplatform,web` profiles: 26 | This will set the `KEYWORDS` parameter accordingly for choosing the tests to be run for Platform mode in web profile. 27 | Also the glassfish web profile bundle will be chosen to run the test against. 28 | ---- 29 | mvn -Pplatform,web clean test surefire-report:report 30 | ---- 31 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/content/using.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/tck-dist/userguide/src/main/jbake/content/using.inc -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/jbake.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program and the accompanying materials are made available under the 5 | # terms of the Eclipse Public License v. 2.0, which is available at 6 | # http://www.eclipse.org/legal/epl-2.0. 7 | # 8 | # This Source Code may also be made available under the following Secondary 9 | # Licenses when the conditions for such availability set forth in the 10 | # Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | # version 2 with the GNU Classpath Exception, which is available at 12 | # https://www.gnu.org/software/classpath/license.html. 13 | # 14 | # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | # 16 | 17 | site.host=http://jbake.org 18 | render.tags=false 19 | render.sitemap=false 20 | render.archive=false 21 | render.feed=false 22 | render.index=false 23 | asciidoctor.option.safe=0 24 | asciidoctor.attributes.export=true -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/templates/footer.ftl: -------------------------------------------------------------------------------- 1 | <#-- a footer template fragment included in the page template --> 2 |


3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | <#if content.prev??> 12 | 18 | 19 | 20 | <#if content.next??> 21 | 27 | 28 | 29 | 35 | 36 |
13 | 14 | 15 | Previous 16 | 17 | 22 | 23 | 24 | Next 25 | 26 | 30 | 31 | 32 | Contents 33 | 34 |
37 | 38 | 39 | Eclipse Foundation Logo  40 | Copyright © 2017, 2021 Oracle and/or its affiliates. All rights reserved. 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/templates/header.ftl: -------------------------------------------------------------------------------- 1 | 2 | <#-- a header template fragment included in the page template --> 3 | 4 | 5 | 6 | <#if (content.title)??><#escape x as x?xml>${content.title}</#escape></#if> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 |
15 | ${content.title}
16 |
19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | <#if content.prev??> 29 | 35 | 36 | 37 | <#if content.next??> 38 | 44 | 45 | 46 | 52 | 53 |
30 | 31 | 32 | Previous 33 | 34 | 39 | 40 | 41 | Next 42 | 43 | 47 | 48 | 49 | Contents 50 | 51 |
54 | 55 | -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/templates/menu.ftl: -------------------------------------------------------------------------------- 1 | <#-- a menu bar template fragment included in the page template --> -------------------------------------------------------------------------------- /tck-dist/userguide/src/main/jbake/templates/page.ftl: -------------------------------------------------------------------------------- 1 | <#-- a top level page layout template --> 2 | 3 | <#include "header.ftl"> 4 | <#include "menu.ftl"> 5 | 6 | ${content.body} 7 | 8 | <#include "footer.ftl"> -------------------------------------------------------------------------------- /tck/async-authentication/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | async-authentication 28 | war 29 | 30 | Jakarta Authentication TCK - async-authentication 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-surefire-plugin 45 | 46 | ${skipEJB} 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /tck/async-authentication/src/main/java/ee/jakarta/tck/authentication/test/ejbasyncauthentication/bean/AsyncBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.ejbasyncauthentication.bean; 17 | 18 | import static java.lang.Thread.interrupted; 19 | import static java.lang.Thread.sleep; 20 | 21 | import java.io.IOException; 22 | 23 | import jakarta.ejb.Asynchronous; 24 | import jakarta.ejb.Stateless; 25 | import jakarta.servlet.AsyncContext; 26 | 27 | /** 28 | * 29 | * @author Arjan Tijms 30 | * 31 | */ 32 | @Stateless 33 | public class AsyncBean { 34 | 35 | @Asynchronous 36 | public void doAsync(AsyncContext asyncContext) { 37 | 38 | try { 39 | sleep(1000); 40 | } catch (InterruptedException e) { 41 | interrupted(); 42 | } 43 | 44 | try { 45 | asyncContext.getResponse().getWriter().write("async response"); 46 | } catch (IOException e) { 47 | e.printStackTrace(); 48 | } 49 | 50 | asyncContext.complete(); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /tck/async-authentication/src/main/java/ee/jakarta/tck/authentication/test/ejbasyncauthentication/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.ejbasyncauthentication.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/async-authentication/src/main/java/ee/jakarta/tck/authentication/test/ejbasyncauthentication/servlet/AsyncServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.ejbasyncauthentication.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import ee.jakarta.tck.authentication.test.ejbasyncauthentication.bean.AsyncBean; 21 | import jakarta.ejb.EJB; 22 | import jakarta.servlet.AsyncContext; 23 | import jakarta.servlet.ServletException; 24 | import jakarta.servlet.annotation.WebServlet; 25 | import jakarta.servlet.http.HttpServlet; 26 | import jakarta.servlet.http.HttpServletRequest; 27 | import jakarta.servlet.http.HttpServletResponse; 28 | 29 | /** 30 | * 31 | * @author Arjan Tijms 32 | * 33 | */ 34 | @WebServlet(urlPatterns = "/public/asyncServlet", asyncSupported = true) 35 | public class AsyncServlet extends HttpServlet { 36 | 37 | private static final long serialVersionUID = 1L; 38 | 39 | @EJB 40 | private AsyncBean asyncBean; 41 | 42 | @Override 43 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 44 | 45 | AsyncContext asyncContext = request.startAsync(); 46 | asyncContext.setTimeout(5000); 47 | 48 | asyncBean.doAsync(asyncContext); 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /tck/async-authentication/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/async-authentication/src/test/java/ee/jakarta/tck/authentication/test/ejbasyncauthentication/AsyncAuthenticationPublicTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.ejbasyncauthentication; 17 | 18 | import static org.junit.Assert.assertTrue; 19 | 20 | import java.io.IOException; 21 | 22 | import org.jboss.arquillian.container.test.api.Deployment; 23 | import org.jboss.arquillian.junit.Arquillian; 24 | import org.jboss.shrinkwrap.api.Archive; 25 | import org.junit.Test; 26 | import org.junit.runner.RunWith; 27 | 28 | import ee.jakarta.tck.authentication.test.common.ArquillianBase; 29 | 30 | /** 31 | * 32 | * 33 | * @author Arjan Tijms 34 | * 35 | */ 36 | @RunWith(Arquillian.class) 37 | public class AsyncAuthenticationPublicTest extends ArquillianBase { 38 | 39 | @Deployment(testable = false) 40 | public static Archive createDeployment() { 41 | return defaultArchive(); 42 | } 43 | 44 | /** 45 | * This tests that an async response works at all in the mere presence of 46 | * a JASPIC SAM (that does nothing) 47 | */ 48 | @Test 49 | public void testBasicAsync() throws IOException { 50 | String response = getFromServerPath("public/asyncServlet"); 51 | assertTrue(response.contains("async response")); 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /tck/authentication-signaturetest/src/test/java/ee/jakarta/tck/authentication/signaturetest/SigTestData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | 17 | 18 | package ee.jakarta.tck.authentication.signaturetest; 19 | 20 | import java.util.Properties; 21 | 22 | /** 23 | * This class holds the data passed to a signature test invocation during the 24 | * setup phase. This allows us to keep the passed data separate and reuse the 25 | * data between the signature test framework base classes. 26 | */ 27 | public class SigTestData { 28 | 29 | private Properties props; 30 | 31 | public SigTestData() { 32 | this.props = System.getProperties();; 33 | } 34 | 35 | public String getTestClasspath() { 36 | return props.getProperty("signature.sigTestClasspath", ""); 37 | } 38 | 39 | public String getProperty(String prop) { 40 | return props.getProperty(prop); 41 | } 42 | 43 | public String getOptionalTechPackagesToIgnore() { 44 | return props.getProperty("optional.tech.packages.to.ignore", "jakarta.xml.bind"); 45 | } 46 | 47 | public String getJImageDir() { 48 | return props.getProperty("jimage.dir", ""); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tck/authentication-signaturetest/src/test/resources/ee/jakarta/tck/authentication/signaturetest/sig-test-pkg-list.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program and the accompanying materials are made available under the 5 | # terms of the Eclipse Public License v. 2.0, which is available at 6 | # http://www.eclipse.org/legal/epl-2.0. 7 | # 8 | # This Source Code may also be made available under the following Secondary 9 | # Licenses when the conditions for such availability set forth in the 10 | # Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | # version 2 with the GNU Classpath Exception, which is available at 12 | # https://www.gnu.org/software/classpath/license.html. 13 | # 14 | # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | # 16 | 17 | ## 18 | # This file contains a list of all the packages 19 | # contained in the signature files for this 20 | # deliverable. This file is used to exclude valid 21 | # sub-packages from being verified when their 22 | # parent package's signature is checked. 23 | ## 24 | 25 | 26 | jakarta.security.auth.message 27 | jakarta.security.auth.message.callback 28 | jakarta.security.auth.message.config 29 | jakarta.security.auth.message.module 30 | -------------------------------------------------------------------------------- /tck/authentication-signaturetest/src/test/resources/ee/jakarta/tck/authentication/signaturetest/sig-test.map: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved. 3 | # 4 | # This program and the accompanying materials are made available under the 5 | # terms of the Eclipse Public License v. 2.0, which is available at 6 | # http://www.eclipse.org/legal/epl-2.0. 7 | # 8 | # This Source Code may also be made available under the following Secondary 9 | # Licenses when the conditions for such availability set forth in the 10 | # Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | # version 2 with the GNU Classpath Exception, which is available at 12 | # https://www.gnu.org/software/classpath/license.html. 13 | # 14 | # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | # 16 | 17 | ############################################################### 18 | # The signature test mapping file for the Faces TCK. This file 19 | # should be formatted as a standard java properties file. The 20 | # name is the package name and the value is the version of the 21 | # package that should be tested by the signature tests. 22 | ############################################################### 23 | 24 | jakarta.security.auth.message=3.1.0-SNAPSHOT 25 | -------------------------------------------------------------------------------- /tck/basic-authentication/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | basic-authentication 28 | war 29 | 30 | Jakarta Authentication TCK - basic-authentication 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tck/basic-authentication/src/main/java/ee/jakarta/tck/authentication/test/basic/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.basic.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/basic-authentication/src/main/java/ee/jakarta/tck/authentication/test/basic/servlet/ProtectedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.basic.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import jakarta.servlet.ServletException; 21 | import jakarta.servlet.annotation.WebServlet; 22 | import jakarta.servlet.http.HttpServlet; 23 | import jakarta.servlet.http.HttpServletRequest; 24 | import jakarta.servlet.http.HttpServletResponse; 25 | 26 | /** 27 | * 28 | * @author Arjan Tijms 29 | * 30 | */ 31 | @WebServlet(urlPatterns = "/protected/servlet") 32 | public class ProtectedServlet extends HttpServlet { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | @Override 37 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | 39 | response.getWriter().write("This is a protected servlet \n"); 40 | 41 | String webName = null; 42 | if (request.getUserPrincipal() != null) { 43 | webName = request.getUserPrincipal().getName(); 44 | } 45 | 46 | response.getWriter().write("web username: " + webName + "\n"); 47 | 48 | boolean webHasRole = request.isUserInRole("architect"); 49 | 50 | response.getWriter().write("web user has role \"architect\": " + webHasRole + "\n"); 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /tck/basic-authentication/src/main/java/ee/jakarta/tck/authentication/test/basic/servlet/PublicServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.basic.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import jakarta.servlet.ServletException; 21 | import jakarta.servlet.annotation.WebServlet; 22 | import jakarta.servlet.http.HttpServlet; 23 | import jakarta.servlet.http.HttpServletRequest; 24 | import jakarta.servlet.http.HttpServletResponse; 25 | 26 | /** 27 | * 28 | * @author Arjan Tijms 29 | * 30 | */ 31 | @WebServlet(urlPatterns = "/public/servlet") 32 | public class PublicServlet extends HttpServlet { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | @Override 37 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | 39 | response.getWriter().write("This is a public servlet \n"); 40 | 41 | String webName = null; 42 | if (request.getUserPrincipal() != null) { 43 | webName = request.getUserPrincipal().getName(); 44 | } 45 | 46 | response.getWriter().write("web username: " + webName + "\n"); 47 | 48 | boolean webHasRole = request.isUserInRole("architect"); 49 | 50 | response.getWriter().write("web user has role \"architect\": " + webHasRole + "\n"); 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /tck/basic-authentication/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/custom-principal/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | custom-principal 28 | war 29 | 30 | Jakarta Authentication TCK - custom principal 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tck/custom-principal/src/main/java/ee/jakarta/tck/authentication/test/customprincipal/sam/MyPrincipal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.customprincipal.sam; 17 | 18 | import java.security.Principal; 19 | 20 | /** 21 | * 22 | * @author Arjan Tijms 23 | * 24 | */ 25 | public class MyPrincipal implements Principal { 26 | 27 | private final String name; 28 | 29 | public MyPrincipal(String name) { 30 | this.name = name; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /tck/custom-principal/src/main/java/ee/jakarta/tck/authentication/test/customprincipal/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.customprincipal.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/custom-principal/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | dispatching-jsf-cdi 28 | war 29 | 30 | Jakarta Authentication TCK - dispatching JSF CDI 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-surefire-plugin 45 | 46 | ${skipJSF} 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/java/ee/jakarta/tck/authentication/test/dispatching/bean/MyBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.bean; 17 | 18 | import jakarta.enterprise.context.RequestScoped; 19 | import jakarta.inject.Inject; 20 | import jakarta.inject.Named; 21 | import jakarta.servlet.http.HttpServletRequest; 22 | 23 | @Named 24 | @RequestScoped 25 | public class MyBean { 26 | 27 | @Inject 28 | private HttpServletRequest request; 29 | 30 | public String getText() { 31 | return "Called from CDI\n"; 32 | } 33 | 34 | public String getServletPath() { 35 | return request.getServletPath(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/java/ee/jakarta/tck/authentication/test/dispatching/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/java/ee/jakarta/tck/authentication/test/dispatching/servlet/IncludedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import ee.jakarta.tck.authentication.test.dispatching.bean.MyBean; 21 | import jakarta.inject.Inject; 22 | import jakarta.servlet.ServletException; 23 | import jakarta.servlet.annotation.WebServlet; 24 | import jakarta.servlet.http.HttpServlet; 25 | import jakarta.servlet.http.HttpServletRequest; 26 | import jakarta.servlet.http.HttpServletResponse; 27 | 28 | /** 29 | * 30 | * @author Arjan Tijms 31 | * 32 | */ 33 | @WebServlet(urlPatterns = "/includedServlet") 34 | public class IncludedServlet extends HttpServlet { 35 | 36 | private static final long serialVersionUID = 1L; 37 | 38 | @Inject 39 | private MyBean myBean; 40 | 41 | @Override 42 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 43 | response.getWriter().write("response from includedServlet - " + myBean.getText()); 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/java/ee/jakarta/tck/authentication/test/dispatching/servlet/ProtectedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.servlet; 17 | import java.io.IOException; 18 | 19 | import jakarta.servlet.ServletException; 20 | import jakarta.servlet.annotation.WebServlet; 21 | import jakarta.servlet.http.HttpServlet; 22 | import jakarta.servlet.http.HttpServletRequest; 23 | import jakarta.servlet.http.HttpServletResponse; 24 | 25 | /** 26 | * 27 | * @author Arjan Tijms 28 | * 29 | */ 30 | @WebServlet(urlPatterns = "/protected/servlet") 31 | public class ProtectedServlet extends HttpServlet { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | @Override 36 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | response.getWriter().write("Resource invoked\n"); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/java/ee/jakarta/tck/authentication/test/dispatching/servlet/PublicServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.servlet; 17 | import java.io.IOException; 18 | 19 | import jakarta.servlet.ServletException; 20 | import jakarta.servlet.annotation.WebServlet; 21 | import jakarta.servlet.http.HttpServlet; 22 | import jakarta.servlet.http.HttpServletRequest; 23 | import jakarta.servlet.http.HttpServletResponse; 24 | 25 | /** 26 | * 27 | * @author Arjan Tijms 28 | * 29 | */ 30 | @WebServlet(urlPatterns = "/public/servlet") 31 | public class PublicServlet extends HttpServlet { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | @Override 36 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | response.getWriter().write("Resource invoked\n"); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/tck/dispatching-jsf-cdi/src/main/webapp/WEB-INF/beans.xml -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/webapp/WEB-INF/faces-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/webapp/forward-cdi.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | Forward with CDI 7 | 8 | 9 | response from JSF forward - #{myBean.text} 10 | 11 | 12 | -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/webapp/forward.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | Forward 7 | 8 | 9 | response from JSF forward 10 | 11 | 12 | -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/webapp/include-cdi.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 21 | 22 | Include with CDI 23 | 24 | 25 | response from JSF include - #{myBean.text} 26 | 27 | 28 | -------------------------------------------------------------------------------- /tck/dispatching-jsf-cdi/src/main/webapp/include.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 21 | 22 | Include 23 | 24 | 25 | response from JSF include 26 | 27 | 28 | -------------------------------------------------------------------------------- /tck/dispatching/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | dispatching 28 | war 29 | 30 | Jakarta Authentication TCK - dispatching 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tck/dispatching/src/main/java/ee/jakarta/tck/authentication/test/dispatching/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/dispatching/src/main/java/ee/jakarta/tck/authentication/test/dispatching/servlet/ForwardedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import jakarta.servlet.ServletException; 21 | import jakarta.servlet.annotation.WebServlet; 22 | import jakarta.servlet.http.HttpServlet; 23 | import jakarta.servlet.http.HttpServletRequest; 24 | import jakarta.servlet.http.HttpServletResponse; 25 | 26 | /** 27 | * 28 | * @author Arjan Tijms 29 | * 30 | */ 31 | @WebServlet(urlPatterns = "/forwardedServlet") 32 | public class ForwardedServlet extends HttpServlet { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | @Override 37 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | response.getWriter().write("response from forwardedServlet"); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /tck/dispatching/src/main/java/ee/jakarta/tck/authentication/test/dispatching/servlet/IncludedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import jakarta.servlet.ServletException; 21 | import jakarta.servlet.annotation.WebServlet; 22 | import jakarta.servlet.http.HttpServlet; 23 | import jakarta.servlet.http.HttpServletRequest; 24 | import jakarta.servlet.http.HttpServletResponse; 25 | 26 | /** 27 | * 28 | * @author Arjan Tijms 29 | * 30 | */ 31 | @WebServlet(urlPatterns = "/includedServlet") 32 | public class IncludedServlet extends HttpServlet { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | @Override 37 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | response.getWriter().write("response from includedServlet"); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /tck/dispatching/src/main/java/ee/jakarta/tck/authentication/test/dispatching/servlet/ProtectedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.servlet; 17 | import java.io.IOException; 18 | 19 | import jakarta.servlet.ServletException; 20 | import jakarta.servlet.annotation.WebServlet; 21 | import jakarta.servlet.http.HttpServlet; 22 | import jakarta.servlet.http.HttpServletRequest; 23 | import jakarta.servlet.http.HttpServletResponse; 24 | 25 | /** 26 | * 27 | * @author Arjan Tijms 28 | * 29 | */ 30 | @WebServlet(urlPatterns = "/protected/servlet") 31 | public class ProtectedServlet extends HttpServlet { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | @Override 36 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | response.getWriter().write("Resource invoked\n"); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /tck/dispatching/src/main/java/ee/jakarta/tck/authentication/test/dispatching/servlet/PublicServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.dispatching.servlet; 17 | import java.io.IOException; 18 | 19 | import jakarta.servlet.ServletException; 20 | import jakarta.servlet.annotation.WebServlet; 21 | import jakarta.servlet.http.HttpServlet; 22 | import jakarta.servlet.http.HttpServletRequest; 23 | import jakarta.servlet.http.HttpServletResponse; 24 | 25 | /** 26 | * 27 | * @author Arjan Tijms 28 | * 29 | */ 30 | @WebServlet(urlPatterns = "/public/servlet") 31 | public class PublicServlet extends HttpServlet { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | @Override 36 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | response.getWriter().write("Resource invoked\n"); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /tck/dispatching/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/ejb-propagation/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | ejb-propagation 28 | war 29 | 30 | Jakarta Authentication TCK - ejb-propagation 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-surefire-plugin 45 | 46 | ${skipEJB} 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /tck/ejb-propagation/src/main/java/ee/jakarta/tck/authentication/test/ejbpropagation/ejb/PublicEJB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.ejbpropagation.ejb; 17 | 18 | import jakarta.annotation.Resource; 19 | import jakarta.ejb.EJBContext; 20 | import jakarta.ejb.Stateless; 21 | 22 | /** 23 | * This is a "public" EJB in the sense that all its methods should be accessible and there is no declarative role checking prior 24 | * to accessing a method. 25 | * 26 | * @author Arjan Tijms 27 | * 28 | */ 29 | @Stateless 30 | public class PublicEJB { 31 | 32 | @Resource 33 | private EJBContext ejbContext; 34 | 35 | public String getUserName() { 36 | try { 37 | return ejbContext.getCallerPrincipal() != null ? ejbContext.getCallerPrincipal().getName() : null; 38 | } catch (Exception e) { 39 | e.printStackTrace(); 40 | } 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tck/ejb-propagation/src/main/java/ee/jakarta/tck/authentication/test/ejbpropagation/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.ejbpropagation.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/ejb-propagation/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/ejb-register-session/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | ejb-register-session 28 | war 29 | 30 | Jakarta Authentication TCK - ejb-register-session 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-surefire-plugin 45 | 46 | ${skipEJB} 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /tck/ejb-register-session/src/main/java/ee/jakarta/tck/authentication/test/registersession/ejb/PublicEJB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.registersession.ejb; 17 | import jakarta.annotation.Resource; 18 | import jakarta.ejb.EJBContext; 19 | import jakarta.ejb.Stateless; 20 | 21 | /** 22 | * This is a "public" EJB in the sense that all its methods should be accessible and there is no declarative role checking prior 23 | * to accessing a method. 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @Stateless 29 | public class PublicEJB { 30 | 31 | @Resource 32 | private EJBContext ejbContext; 33 | 34 | public String getUserName() { 35 | try { 36 | return ejbContext.getCallerPrincipal() != null ? ejbContext.getCallerPrincipal().getName() : null; 37 | } catch (Exception e) { 38 | e.printStackTrace(); 39 | } 40 | return null; 41 | } 42 | } -------------------------------------------------------------------------------- /tck/ejb-register-session/src/main/java/ee/jakarta/tck/authentication/test/registersession/sam/MyPrincipal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.registersession.sam; 17 | 18 | import java.security.Principal; 19 | 20 | /** 21 | * 22 | * @author Arjan Tijms 23 | * 24 | */ 25 | public class MyPrincipal implements Principal { 26 | 27 | private final String name; 28 | 29 | public MyPrincipal(String name) { 30 | this.name = name; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /tck/ejb-register-session/src/main/java/ee/jakarta/tck/authentication/test/registersession/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.registersession.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/ejb-register-session/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 25 | Test 26 | /protected/* 27 | 28 | 29 | architect 30 | 31 | 32 | 33 | 34 | architect 35 | 36 | 37 | -------------------------------------------------------------------------------- /tck/invoke-ejb-cdi/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | invoke-ejb-cdi 28 | war 29 | 30 | Jakarta Authentication TCK - invoke EJB and CDI 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-surefire-plugin 45 | 46 | ${skipEJB} 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /tck/invoke-ejb-cdi/src/main/java/ee/jakarta/tck/authentication/test/invoke/bean/CDIBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.invoke.bean; 17 | 18 | import jakarta.enterprise.context.RequestScoped; 19 | import jakarta.inject.Inject; 20 | import jakarta.inject.Named; 21 | import jakarta.servlet.http.HttpServletRequest; 22 | 23 | @Named 24 | @RequestScoped 25 | public class CDIBean { 26 | 27 | @Inject 28 | private HttpServletRequest request; 29 | 30 | public String getText() { 31 | return "Called from CDI"; 32 | } 33 | 34 | public void setTextViaInjectedRequest() { 35 | request.setAttribute("text", "Called from CDI via injected request"); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /tck/invoke-ejb-cdi/src/main/java/ee/jakarta/tck/authentication/test/invoke/bean/EJBBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.invoke.bean; 17 | 18 | import jakarta.ejb.Stateless; 19 | 20 | @Stateless 21 | public class EJBBean { 22 | 23 | public String getText() { 24 | return "Called from EJB"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /tck/invoke-ejb-cdi/src/main/java/ee/jakarta/tck/authentication/test/invoke/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.invoke.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/invoke-ejb-cdi/src/main/java/ee/jakarta/tck/authentication/test/invoke/servlet/ProtectedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.invoke.servlet; 17 | import java.io.IOException; 18 | 19 | import jakarta.servlet.ServletException; 20 | import jakarta.servlet.annotation.WebServlet; 21 | import jakarta.servlet.http.HttpServlet; 22 | import jakarta.servlet.http.HttpServletRequest; 23 | import jakarta.servlet.http.HttpServletResponse; 24 | 25 | /** 26 | * 27 | * @author Arjan Tijms 28 | * 29 | */ 30 | @WebServlet(urlPatterns = "/protected/servlet") 31 | public class ProtectedServlet extends HttpServlet { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | @Override 36 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | response.getWriter().write("Resource invoked\n"); 38 | request.logout(); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /tck/invoke-ejb-cdi/src/main/java/ee/jakarta/tck/authentication/test/invoke/servlet/PublicServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.invoke.servlet; 17 | import java.io.IOException; 18 | 19 | import jakarta.servlet.ServletException; 20 | import jakarta.servlet.annotation.WebServlet; 21 | import jakarta.servlet.http.HttpServlet; 22 | import jakarta.servlet.http.HttpServletRequest; 23 | import jakarta.servlet.http.HttpServletResponse; 24 | 25 | /** 26 | * 27 | * @author Arjan Tijms 28 | * 29 | */ 30 | @WebServlet(urlPatterns = "/public/servlet") 31 | public class PublicServlet extends HttpServlet { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | @Override 36 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | response.getWriter().write("Resource invoked\n"); 38 | request.logout(); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /tck/invoke-ejb-cdi/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakartaee/authentication/1d70d3f1085dce6dd9eb8e7dfe745c02eaa2ed75/tck/invoke-ejb-cdi/src/main/webapp/WEB-INF/beans.xml -------------------------------------------------------------------------------- /tck/invoke-ejb-cdi/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/jacc-propagation/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | authorization-propagation 28 | war 29 | 30 | Jakarta Authentication TCK - authorization-propagation 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-surefire-plugin 45 | 46 | ${skipJACC} 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /tck/jacc-propagation/src/main/java/ee/jakarta/tck/authentication/test/authzpropagation/jacc/JakartaAuthorization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.authzpropagation.jacc; 17 | 18 | import static java.util.logging.Level.SEVERE; 19 | 20 | import jakarta.security.jacc.PolicyContext; 21 | import jakarta.security.jacc.PolicyFactory; 22 | import jakarta.security.jacc.WebResourcePermission; 23 | import java.util.logging.Logger; 24 | import javax.security.auth.Subject; 25 | 26 | /** 27 | * 28 | * @author Arjan Tijms 29 | * 30 | */ 31 | public class JakartaAuthorization { 32 | 33 | private final static Logger logger = Logger.getLogger(JakartaAuthorization.class.getName()); 34 | 35 | public static Subject getSubject() { 36 | try { 37 | return (Subject) PolicyContext.getContext("javax.security.auth.Subject.container"); 38 | } catch (Exception e) { 39 | logger.log(SEVERE, "", e); 40 | } 41 | 42 | return null; 43 | } 44 | 45 | public static boolean hasAccess(String uri, Subject subject) { 46 | return PolicyFactory.getPolicyFactory().getPolicy().implies( 47 | new WebResourcePermission(uri, "GET"), 48 | subject.getPrincipals() 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tck/jacc-propagation/src/main/java/ee/jakarta/tck/authentication/test/authzpropagation/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.authzpropagation.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/jacc-propagation/src/main/java/ee/jakarta/tck/authentication/test/authzpropagation/servlet/ProtectedServlet.java: -------------------------------------------------------------------------------- 1 | package ee.jakarta.tck.authentication.test.authzpropagation.servlet; 2 | 3 | import static ee.jakarta.tck.authentication.test.authzpropagation.jacc.JakartaAuthorization.getSubject; 4 | import static ee.jakarta.tck.authentication.test.authzpropagation.jacc.JakartaAuthorization.hasAccess; 5 | 6 | import java.io.IOException; 7 | 8 | import javax.security.auth.Subject; 9 | import jakarta.servlet.ServletException; 10 | import jakarta.servlet.annotation.WebServlet; 11 | import jakarta.servlet.http.HttpServlet; 12 | import jakarta.servlet.http.HttpServletRequest; 13 | import jakarta.servlet.http.HttpServletResponse; 14 | 15 | /** 16 | * 17 | * @author Arjan Tijms 18 | * 19 | */ 20 | @WebServlet(urlPatterns = "/protected/servlet") 21 | public class ProtectedServlet extends HttpServlet { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | @Override 26 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 27 | 28 | // Obtain the active subject via a JACC policy handler 29 | Subject subject = getSubject(); 30 | 31 | if (subject == null) { 32 | response.getWriter().write("Can't get Subject. JACC doesn't seem to be available."); 33 | return; 34 | } 35 | 36 | // Check with JACC if the caller has access to this Servlet. As we're 37 | // currently in this very Servlet the answer can't be anything than "true" if 38 | // JASPIC, JACC and role propagation all work correctly. 39 | response.getWriter().write("Has access to /protected/servlet: " + hasAccess("/protected/servlet", subject)); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /tck/jacc-propagation/src/main/java/ee/jakarta/tck/authentication/test/authzpropagation/servlet/PublicServlet.java: -------------------------------------------------------------------------------- 1 | package ee.jakarta.tck.authentication.test.authzpropagation.servlet; 2 | 3 | import static ee.jakarta.tck.authentication.test.authzpropagation.jacc.JakartaAuthorization.getSubject; 4 | import static ee.jakarta.tck.authentication.test.authzpropagation.jacc.JakartaAuthorization.hasAccess; 5 | 6 | import java.io.IOException; 7 | 8 | import javax.security.auth.Subject; 9 | import jakarta.servlet.ServletException; 10 | import jakarta.servlet.annotation.WebServlet; 11 | import jakarta.servlet.http.HttpServlet; 12 | import jakarta.servlet.http.HttpServletRequest; 13 | import jakarta.servlet.http.HttpServletResponse; 14 | 15 | /** 16 | * 17 | * @author Arjan Tijms 18 | * 19 | */ 20 | @WebServlet(urlPatterns = "/public/servlet") 21 | public class PublicServlet extends HttpServlet { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | @Override 26 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 27 | 28 | // Obtain the active subject via a JACC policy handler 29 | Subject subject = getSubject(); 30 | 31 | if (subject == null) { 32 | response.getWriter().write("Can't get Subject. JACC doesn't seem to be available."); 33 | return; 34 | } 35 | 36 | // Check with JACC if the caller has access to this Servlet. As we're 37 | // currently in this very Servlet and it's a public Servlet,the answer can't be anything 38 | // than "true". 39 | 40 | response.getWriter().write("Has access to /public/servlet: " + hasAccess("/public/servlet", subject)); 41 | 42 | // Check with JACC if the caller has access to another (protected) Servlet. If JACC 43 | // works correctly and we're authenticated this should be true. 44 | 45 | response.getWriter().write( 46 | "\nHas access to /protected/servlet: " + hasAccess("/protected/servlet", subject)); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /tck/jacc-propagation/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/lifecycle/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | lifecycle 28 | war 29 | 30 | Jakarta Authentication TCK - lifecycle 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tck/lifecycle/src/main/java/ee/jakarta/tck/authentication/test/lifecycle/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.lifecycle.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestLifecycleAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/lifecycle/src/main/java/ee/jakarta/tck/authentication/test/lifecycle/servlet/ProtectedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.lifecycle.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import jakarta.servlet.ServletException; 21 | import jakarta.servlet.annotation.WebServlet; 22 | import jakarta.servlet.http.HttpServlet; 23 | import jakarta.servlet.http.HttpServletRequest; 24 | import jakarta.servlet.http.HttpServletResponse; 25 | 26 | /** 27 | * 28 | * @author Arjan Tijms 29 | * 30 | */ 31 | @WebServlet(urlPatterns = "/protected/servlet") 32 | public class ProtectedServlet extends HttpServlet { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | @Override 37 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | response.getWriter().write("Resource invoked\n"); 39 | 40 | if (request.getParameter("doLogout") != null) { 41 | request.logout(); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /tck/lifecycle/src/main/java/ee/jakarta/tck/authentication/test/lifecycle/servlet/PublicServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.lifecycle.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import jakarta.servlet.ServletException; 21 | import jakarta.servlet.annotation.WebServlet; 22 | import jakarta.servlet.http.HttpServlet; 23 | import jakarta.servlet.http.HttpServletRequest; 24 | import jakarta.servlet.http.HttpServletResponse; 25 | 26 | /** 27 | * 28 | * @author Arjan Tijms 29 | * 30 | */ 31 | @WebServlet(urlPatterns = "/public/servlet") 32 | public class PublicServlet extends HttpServlet { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | @Override 37 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | response.getWriter().write("Public resource invoked\n"); 39 | 40 | if (request.getParameter("doLogout") != null) { 41 | request.logout(); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /tck/lifecycle/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/programmatic-authentication/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | programmatic-authentication 28 | war 29 | 30 | Jakarta Authentication TCK - programmatic-authentication 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tck/programmatic-authentication/src/main/java/ee/jakarta/tck/authentication/test/programmaticauthentication/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.programmaticauthentication.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/programmatic-authentication/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/register-session/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | register-session 28 | war 29 | 30 | Jakarta Authentication TCK - register-session 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /tck/register-session/src/main/java/ee/jakarta/tck/authentication/test/registersession/sam/MyPrincipal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.registersession.sam; 17 | 18 | import java.security.Principal; 19 | 20 | /** 21 | * 22 | * @author Arjan Tijms 23 | * 24 | */ 25 | public class MyPrincipal implements Principal { 26 | 27 | private final String name; 28 | 29 | public MyPrincipal(String name) { 30 | this.name = name; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /tck/register-session/src/main/java/ee/jakarta/tck/authentication/test/registersession/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.registersession.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/register-session/src/main/java/ee/jakarta/tck/authentication/test/registersession/servlet/ProtectedServlet.java: -------------------------------------------------------------------------------- 1 | package ee.jakarta.tck.authentication.test.registersession.servlet; 2 | 3 | import java.io.IOException; 4 | import java.security.Principal; 5 | 6 | import ee.jakarta.tck.authentication.test.registersession.sam.MyPrincipal; 7 | import jakarta.servlet.ServletException; 8 | import jakarta.servlet.annotation.WebServlet; 9 | import jakarta.servlet.http.HttpServlet; 10 | import jakarta.servlet.http.HttpServletRequest; 11 | import jakarta.servlet.http.HttpServletResponse; 12 | import jakarta.servlet.http.HttpSession; 13 | 14 | 15 | /** 16 | * 17 | * @author Arjan Tijms 18 | * 19 | */ 20 | @WebServlet(urlPatterns = "/protected/servlet") 21 | public class ProtectedServlet extends HttpServlet { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | @Override 26 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 27 | 28 | response.getWriter().write("This is a protected servlet \n"); 29 | 30 | String webName = null; 31 | boolean isCustomPrincipal = false; 32 | if (request.getUserPrincipal() != null) { 33 | Principal principal = request.getUserPrincipal(); 34 | isCustomPrincipal = principal instanceof MyPrincipal; 35 | webName = request.getUserPrincipal().getName(); 36 | } 37 | 38 | boolean webHasRole = request.isUserInRole("architect"); 39 | 40 | response.getWriter().write("isCustomPrincipal: " + isCustomPrincipal + "\n"); 41 | response.getWriter().write("web username: " + webName + "\n"); 42 | response.getWriter().write("web user has role \"architect\": " + webHasRole + "\n"); 43 | 44 | HttpSession session = request.getSession(false); 45 | if (session != null) { 46 | response.getWriter().write("Session ID: " + session.getId()); 47 | } else { 48 | response.getWriter().write("No session"); 49 | } 50 | 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /tck/register-session/src/main/java/ee/jakarta/tck/authentication/test/registersession/servlet/PublicServlet.java: -------------------------------------------------------------------------------- 1 | package ee.jakarta.tck.authentication.test.registersession.servlet; 2 | 3 | import java.io.IOException; 4 | import java.security.Principal; 5 | 6 | import ee.jakarta.tck.authentication.test.registersession.sam.MyPrincipal; 7 | import jakarta.servlet.ServletException; 8 | import jakarta.servlet.annotation.WebServlet; 9 | import jakarta.servlet.http.HttpServlet; 10 | import jakarta.servlet.http.HttpServletRequest; 11 | import jakarta.servlet.http.HttpServletResponse; 12 | import jakarta.servlet.http.HttpSession; 13 | 14 | 15 | /** 16 | * 17 | * @author Arjan Tijms 18 | * 19 | */ 20 | @WebServlet(urlPatterns = "/public/servlet") 21 | public class PublicServlet extends HttpServlet { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | @Override 26 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 27 | 28 | response.getWriter().write("This is a public servlet \n"); 29 | 30 | String webName = null; 31 | boolean isCustomPrincipal = false; 32 | if (request.getUserPrincipal() != null) { 33 | Principal principal = request.getUserPrincipal(); 34 | isCustomPrincipal = principal instanceof MyPrincipal; 35 | webName = principal.getName(); 36 | } 37 | 38 | boolean webHasRole = request.isUserInRole("architect"); 39 | 40 | response.getWriter().write("isCustomPrincipal: " + isCustomPrincipal + "\n"); 41 | response.getWriter().write("web username: " + webName + "\n"); 42 | response.getWriter().write("web user has role \"architect\": " + webHasRole + "\n"); 43 | 44 | HttpSession session = request.getSession(false); 45 | if (session != null) { 46 | response.getWriter().write("Session ID: " + session.getId()); 47 | } else { 48 | response.getWriter().write("No session"); 49 | } 50 | 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /tck/register-session/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 25 | Test 26 | /protected/* 27 | 28 | 29 | architect 30 | 31 | 32 | 33 | 34 | architect 35 | 36 | 37 | -------------------------------------------------------------------------------- /tck/spi/common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | spi 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | spi.common 28 | 29 | Jakarta Authentication TCK - Profile SPI Common 30 | 31 | A lot of tests about the nitty gritty regarding the SPI per profile. 32 | 33 | 34 | 35 | 36 | org.jakartaee 37 | jaspic-common 38 | 1.0-SNAPSHOT 39 | 40 | 41 | jakarta.xml.ws 42 | jakarta.xml.ws-api 43 | 4.0.2 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /tck/spi/common/src/main/java/ee/jakarta/tck/authentication/test/basic/sam/module/servlet/TSResponseWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to Eclipse Foundation. 3 | * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under the 6 | * terms of the Eclipse Public License v. 2.0, which is available at 7 | * http://www.eclipse.org/legal/epl-2.0. 8 | * 9 | * This Source Code may also be made available under the following Secondary 10 | * Licenses when the conditions for such availability set forth in the 11 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 12 | * version 2 with the GNU Classpath Exception, which is available at 13 | * https://www.gnu.org/software/classpath/license.html. 14 | * 15 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 16 | */ 17 | 18 | package ee.jakarta.tck.authentication.test.basic.sam.module.servlet; 19 | 20 | import ee.jakarta.tck.authentication.test.basic.servlet.JASPICData; 21 | import ee.jakarta.tck.authentication.test.common.logging.server.TSLogger; 22 | import jakarta.servlet.http.HttpServletResponse; 23 | import jakarta.servlet.http.HttpServletResponseWrapper; 24 | import java.util.logging.Level; 25 | 26 | public class TSResponseWrapper extends HttpServletResponseWrapper { 27 | private TSLogger logger = null; 28 | 29 | public TSResponseWrapper(HttpServletResponse response) { 30 | super(response); 31 | logger = TSLogger.getTSLogger(JASPICData.LOGGER_NAME); 32 | logMsg("TSResponseWrapper constructor called"); 33 | } 34 | 35 | @Override 36 | public String getHeader(String name) { 37 | 38 | if ("isResponseWrapped".equals(name)) { 39 | return "true"; 40 | } 41 | 42 | return super.getHeader(name); 43 | } 44 | 45 | public void logMsg(String str) { 46 | if (logger != null) { 47 | logger.log(Level.INFO, str); 48 | } else { 49 | System.out.println("*** TSLogger Not Initialized properly ***"); 50 | System.out.println("*** TSSVLogMessage : ***" + str); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /tck/spi/common/src/main/java/ee/jakarta/tck/authentication/test/basic/sam/util/CEFormatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to Eclipse Foundation. 3 | * Copyright (c) 1995, 2018 Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under the 6 | * terms of the Eclipse Public License v. 2.0, which is available at 7 | * http://www.eclipse.org/legal/epl-2.0. 8 | * 9 | * This Source Code may also be made available under the following Secondary 10 | * Licenses when the conditions for such availability set forth in the 11 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 12 | * version 2 with the GNU Classpath Exception, which is available at 13 | * https://www.gnu.org/software/classpath/license.html. 14 | * 15 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 16 | */ 17 | package ee.jakarta.tck.authentication.test.basic.sam.util; 18 | 19 | import java.io.IOException; 20 | 21 | public class CEFormatException extends IOException { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public CEFormatException(String s) { 25 | super(s); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tck/spi/common/src/main/java/ee/jakarta/tck/authentication/test/basic/sam/util/CEStreamExhausted.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to Eclipse Foundation. 3 | * Copyright (c) 1995, 2018 Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * This program and the accompanying materials are made available under the 6 | * terms of the Eclipse Public License v. 2.0, which is available at 7 | * http://www.eclipse.org/legal/epl-2.0. 8 | * 9 | * This Source Code may also be made available under the following Secondary 10 | * Licenses when the conditions for such availability set forth in the 11 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 12 | * version 2 with the GNU Classpath Exception, which is available at 13 | * https://www.gnu.org/software/classpath/license.html. 14 | * 15 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 16 | */ 17 | package ee.jakarta.tck.authentication.test.basic.sam.util; 18 | 19 | import java.io.IOException; 20 | 21 | /** This exception is thrown when EOF is reached */ 22 | public class CEStreamExhausted extends IOException { 23 | 24 | private static final long serialVersionUID = 1L; 25 | }; 26 | -------------------------------------------------------------------------------- /tck/spi/common/src/main/resources/META-INF/services/jakarta.servlet.ServletContainerInitializer: -------------------------------------------------------------------------------- 1 | ee.jakarta.tck.authentication.test.basic.servlet.AuthFactoryContainerInitializer -------------------------------------------------------------------------------- /tck/spi/common/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | spi_servlet 22 | 23 | 24 | BASIC 25 | default 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tck/spi/servlet/auth.conf: -------------------------------------------------------------------------------- 1 | reg-entry { 2 | con-entry { 3 | ee.jakarta.tck.authentication.test.basic.sam.config.TSAuthConfigProvider 4 | AuthStatus_SEND_SUCCESS:false 5 | requestPolicy:USER_NAME_PASSWORD 6 | } 7 | reg-ctx { 8 | layer:SOAP 9 | app-ctx:null 10 | description:TestSuite JSR 196 Config Provider 11 | } 12 | reg-ctx { 13 | layer:SOAP 14 | app-ctx:localhost /Hello_web/Hello 15 | description:TestSuite JSR 196 Config Provider 16 | } 17 | } 18 | reg-entry { 19 | con-entry { 20 | ee.jakarta.tck.authentication.test.basic.sam.TSAuthConfigProviderServlet 21 | AuthStatus_SEND_SUCCESS:true 22 | requestPolicy:USER_NAME_PASSWORD 23 | } 24 | reg-ctx { 25 | layer:HttpServlet 26 | app-ctx:server /spitests_servlet_web 27 | description:Registration for TSAuthConfigProviderServlet using spitests_servlet_web 28 | } 29 | reg-ctx { 30 | layer:HttpServlet 31 | app-ctx:server /spitests_servlet_web/WrapperServlet 32 | description:Registration for TSAuthConfigProviderServlet using spitests_servlet_web 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tck/spi/servlet/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | spi 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | spi.servlet 28 | war 29 | 30 | Jakarta Authentication TCK - Profile SPI Servlet 31 | 32 | A lot of tests about the nitty gritty regarding the SPI per profile. 33 | 34 | 35 | 36 | 37 | org.jakartaee 38 | jaspic-common 39 | 1.0-SNAPSHOT 40 | 41 | 42 | org.eclipse.ee4j.tck.authentication 43 | spi.common 44 | ${project.version} 45 | 46 | 47 | 48 | 49 | spitests_servlet_web 50 | 51 | 52 | -------------------------------------------------------------------------------- /tck/spi/servlet/src/main/java/ee/jakarta/tck/authentication/test/basic/servlet/AuthFactoryContainerInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to Eclipse Foundation. 3 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 4 | * 5 | * This program and the accompanying materials are made available under the 6 | * terms of the Eclipse Public License v. 2.0, which is available at 7 | * http://www.eclipse.org/legal/epl-2.0. 8 | * 9 | * This Source Code may also be made available under the following Secondary 10 | * Licenses when the conditions for such availability set forth in the 11 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 12 | * version 2 with the GNU Classpath Exception, which is available at 13 | * https://www.gnu.org/software/classpath/license.html. 14 | * 15 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 16 | */ 17 | package ee.jakarta.tck.authentication.test.basic.servlet; 18 | 19 | import ee.jakarta.tck.authentication.test.basic.sam.config.TSAuthConfigFactory; 20 | import jakarta.security.auth.message.config.AuthConfigFactory; 21 | import jakarta.servlet.ServletContainerInitializer; 22 | import jakarta.servlet.ServletContext; 23 | import jakarta.servlet.ServletException; 24 | import java.util.Set; 25 | 26 | public class AuthFactoryContainerInitializer implements ServletContainerInitializer { 27 | 28 | @Override 29 | public void onStartup(Set> c, ServletContext ctx) throws ServletException { 30 | AuthConfigFactory.setFactory(new TSAuthConfigFactory()); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /tck/spi/servlet/src/main/resources/META-INF/services/jakarta.servlet.ServletContainerInitializer: -------------------------------------------------------------------------------- 1 | ee.jakarta.tck.authentication.test.basic.servlet.AuthFactoryContainerInitializer -------------------------------------------------------------------------------- /tck/spi/servlet/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | spi_servlet 22 | 23 | 24 | BASIC 25 | default 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tck/spi/soap/auth.conf: -------------------------------------------------------------------------------- 1 | reg-entry { 2 | con-entry { 3 | ee.jakarta.tck.authentication.test.basic.sam.config.TSAuthConfigProvider 4 | AuthStatus_SEND_SUCCESS:false 5 | requestPolicy:USER_NAME_PASSWORD 6 | } 7 | reg-ctx { 8 | layer:SOAP 9 | app-ctx:null 10 | description:TestSuite JSR 196 Config Provider 11 | } 12 | reg-ctx { 13 | layer:SOAP 14 | app-ctx:localhost /Hello_web/Hello 15 | description:TestSuite JSR 196 Config Provider 16 | } 17 | } 18 | reg-entry { 19 | con-entry { 20 | ee.jakarta.tck.authentication.test.basic.sam.TSAuthConfigProviderServlet 21 | AuthStatus_SEND_SUCCESS:true 22 | requestPolicy:USER_NAME_PASSWORD 23 | } 24 | reg-ctx { 25 | layer:HttpServlet 26 | app-ctx:server /spitests_servlet_web 27 | description:Registration for TSAuthConfigProviderServlet using spitests_servlet_web 28 | } 29 | reg-ctx { 30 | layer:HttpServlet 31 | app-ctx:server /spitests_servlet_web/WrapperServlet 32 | description:Registration for TSAuthConfigProviderServlet using spitests_servlet_web 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tck/spi/soap/src/main/java/ee/jakarta/tck/authentication/test/basic/soap/AuthFactoryContainerInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.basic.soap; 17 | 18 | import ee.jakarta.tck.authentication.test.basic.sam.config.TSAuthConfigFactory; 19 | import jakarta.security.auth.message.config.AuthConfigFactory; 20 | import jakarta.servlet.ServletContainerInitializer; 21 | import jakarta.servlet.ServletContext; 22 | import jakarta.servlet.ServletException; 23 | import java.util.Set; 24 | 25 | public class AuthFactoryContainerInitializer implements ServletContainerInitializer { 26 | 27 | @Override 28 | public void onStartup(Set> c, ServletContext ctx) throws ServletException { 29 | AuthConfigFactory.setFactory(new TSAuthConfigFactory()); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /tck/spi/soap/src/main/java/ee/jakarta/tck/authentication/test/basic/soap/Hello.java: -------------------------------------------------------------------------------- 1 | 2 | package ee.jakarta.tck.authentication.test.basic.soap; 3 | 4 | import jakarta.jws.WebMethod; 5 | import jakarta.jws.WebParam; 6 | import jakarta.jws.WebResult; 7 | import jakarta.jws.WebService; 8 | import jakarta.xml.bind.annotation.XmlSeeAlso; 9 | import jakarta.xml.ws.Action; 10 | import jakarta.xml.ws.RequestWrapper; 11 | import jakarta.xml.ws.ResponseWrapper; 12 | 13 | 14 | /** 15 | * This class was generated by the XML-WS Tools. 16 | * XML-WS Tools 4.0.1 17 | * Generated source version: 3.0 18 | * 19 | */ 20 | @WebService(name = "Hello", targetNamespace = "http://soap.basic.test.authentication.tck.jakarta.ee/") 21 | @XmlSeeAlso({ 22 | ObjectFactory.class 23 | }) 24 | public interface Hello { 25 | 26 | 27 | /** 28 | * 29 | * @param arg0 30 | * @return 31 | * returns java.lang.String 32 | */ 33 | @WebMethod 34 | @WebResult(targetNamespace = "") 35 | @RequestWrapper(localName = "sayHelloProtected", targetNamespace = "http://soap.basic.test.authentication.tck.jakarta.ee/", className = "ee.jakarta.tck.authentication.test.basic.soap.SayHelloProtected") 36 | @ResponseWrapper(localName = "sayHelloProtectedResponse", targetNamespace = "http://soap.basic.test.authentication.tck.jakarta.ee/", className = "ee.jakarta.tck.authentication.test.basic.soap.SayHelloProtectedResponse") 37 | @Action(input = "http://soap.basic.test.authentication.tck.jakarta.ee/Hello/sayHelloProtectedRequest", output = "http://soap.basic.test.authentication.tck.jakarta.ee/Hello/sayHelloProtectedResponse") 38 | public String sayHelloProtected( 39 | @WebParam(name = "arg0", targetNamespace = "") 40 | String arg0); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /tck/spi/soap/src/main/java/ee/jakarta/tck/authentication/test/basic/soap/HelloImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | 17 | package ee.jakarta.tck.authentication.test.basic.soap; 18 | 19 | import jakarta.jws.WebMethod; 20 | import jakarta.jws.WebService; 21 | 22 | @WebService(name = "Hello", serviceName = "HelloService") 23 | public class HelloImpl { 24 | 25 | @WebMethod 26 | public String sayHelloProtected(String param) { 27 | return "Hello " + param; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tck/spi/soap/src/main/java/ee/jakarta/tck/authentication/test/basic/soap/SayHelloProtected.java: -------------------------------------------------------------------------------- 1 | 2 | package ee.jakarta.tck.authentication.test.basic.soap; 3 | 4 | import jakarta.xml.bind.annotation.XmlAccessType; 5 | import jakarta.xml.bind.annotation.XmlAccessorType; 6 | import jakarta.xml.bind.annotation.XmlType; 7 | 8 | 9 | /** 10 | *

Java class for sayHelloProtected complex type. 11 | * 12 | *

The following schema fragment specifies the expected content contained within this class. 13 | * 14 | *

{@code
15 |  * 
16 |  *   
17 |  *     
18 |  *       
19 |  *         
20 |  *       
21 |  *     
22 |  *   
23 |  * 
24 |  * }
25 | * 26 | * 27 | */ 28 | @XmlAccessorType(XmlAccessType.FIELD) 29 | @XmlType(name = "sayHelloProtected", propOrder = { 30 | "arg0" 31 | }) 32 | public class SayHelloProtected { 33 | 34 | protected String arg0; 35 | 36 | /** 37 | * Gets the value of the arg0 property. 38 | * 39 | * @return 40 | * possible object is 41 | * {@link String } 42 | * 43 | */ 44 | public String getArg0() { 45 | return arg0; 46 | } 47 | 48 | /** 49 | * Sets the value of the arg0 property. 50 | * 51 | * @param value 52 | * allowed object is 53 | * {@link String } 54 | * 55 | */ 56 | public void setArg0(String value) { 57 | this.arg0 = value; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /tck/spi/soap/src/main/java/ee/jakarta/tck/authentication/test/basic/soap/SayHelloProtectedResponse.java: -------------------------------------------------------------------------------- 1 | 2 | package ee.jakarta.tck.authentication.test.basic.soap; 3 | 4 | import jakarta.xml.bind.annotation.XmlAccessType; 5 | import jakarta.xml.bind.annotation.XmlAccessorType; 6 | import jakarta.xml.bind.annotation.XmlElement; 7 | import jakarta.xml.bind.annotation.XmlType; 8 | 9 | 10 | /** 11 | *

Java class for sayHelloProtectedResponse complex type. 12 | * 13 | *

The following schema fragment specifies the expected content contained within this class. 14 | * 15 | *

{@code
16 |  * 
17 |  *   
18 |  *     
19 |  *       
20 |  *         
21 |  *       
22 |  *     
23 |  *   
24 |  * 
25 |  * }
26 | * 27 | * 28 | */ 29 | @XmlAccessorType(XmlAccessType.FIELD) 30 | @XmlType(name = "sayHelloProtectedResponse", propOrder = { 31 | "_return" 32 | }) 33 | public class SayHelloProtectedResponse { 34 | 35 | @XmlElement(name = "return") 36 | protected String _return; 37 | 38 | /** 39 | * Gets the value of the return property. 40 | * 41 | * @return 42 | * possible object is 43 | * {@link String } 44 | * 45 | */ 46 | public String getReturn() { 47 | return _return; 48 | } 49 | 50 | /** 51 | * Sets the value of the return property. 52 | * 53 | * @param value 54 | * allowed object is 55 | * {@link String } 56 | * 57 | */ 58 | public void setReturn(String value) { 59 | this._return = value; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /tck/spi/soap/src/main/java/ee/jakarta/tck/authentication/test/basic/soap/package-info.java: -------------------------------------------------------------------------------- 1 | @jakarta.xml.bind.annotation.XmlSchema(namespace = "http://soap.basic.test.authentication.tck.jakarta.ee/") 2 | package ee.jakarta.tck.authentication.test.basic.soap; 3 | -------------------------------------------------------------------------------- /tck/spi/soap/src/main/resources/META-INF/services/com.sun.xml.ws.assembler.metro.dev.ClientPipelineHook: -------------------------------------------------------------------------------- 1 | com.sun.enterprise.security.webservices.client.ClientSecurityPipeCreator -------------------------------------------------------------------------------- /tck/spi/soap/src/main/resources/META-INF/services/jakarta.servlet.ServletContainerInitializer: -------------------------------------------------------------------------------- 1 | ee.jakarta.tck.authentication.test.basic.servlet.AuthFactoryContainerInitializer -------------------------------------------------------------------------------- /tck/spi/soap/src/main/webapp/WEB-INF/HelloService_schema1.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tck/spi/soap/src/main/webapp/WEB-INF/soap-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 24 | 25 | soap_app 26 | 27 | 28 | Hello 29 | ee.jakarta.tck.authentication.test.basic.soap.HelloImpl 30 | 0 31 | 32 | ADM 33 | Administrator 34 | 35 | 36 | 37 | Hello 38 | /Hello 39 | 40 | 41 | 42 | 54 43 | 44 | 45 | 46 | the administrator role 47 | Administrator 48 | 49 | 50 | -------------------------------------------------------------------------------- /tck/spi/soap/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | spi_servlet 22 | 23 | 24 | BASIC 25 | default 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tck/status-codes/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | status-codes 28 | war 29 | 30 | Jakarta Authentication TCK - status-codes 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tck/status-codes/src/main/java/ee/jakarta/tck/authentication/test/statuscodes/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.statuscodes.sam; 17 | 18 | import jakarta.security.auth.message.config.AuthConfigFactory; 19 | import jakarta.servlet.ServletContextEvent; 20 | import jakarta.servlet.ServletContextListener; 21 | import jakarta.servlet.annotation.WebListener; 22 | 23 | /** 24 | * 25 | * @author Arjan Tijms 26 | * 27 | */ 28 | @WebListener 29 | public class SamAutoRegistrationListener implements ServletContextListener { 30 | 31 | @Override 32 | public void contextInitialized(ServletContextEvent sce) { 33 | AuthConfigFactory.getFactory() 34 | .registerServerAuthModule(new TestServerAuthModule(), sce.getServletContext()); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /tck/status-codes/src/main/java/ee/jakarta/tck/authentication/test/statuscodes/servlet/ProtectedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.statuscodes.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import jakarta.servlet.ServletException; 21 | import jakarta.servlet.annotation.WebServlet; 22 | import jakarta.servlet.http.HttpServlet; 23 | import jakarta.servlet.http.HttpServletRequest; 24 | import jakarta.servlet.http.HttpServletResponse; 25 | 26 | /** 27 | * 28 | * @author Arjan Tijms 29 | * 30 | */ 31 | @WebServlet(urlPatterns = "/protected/servlet") 32 | public class ProtectedServlet extends HttpServlet { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | @Override 37 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | response.getWriter().write("This is a protected servlet \n"); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /tck/status-codes/src/main/java/ee/jakarta/tck/authentication/test/statuscodes/servlet/PublicServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.statuscodes.servlet; 17 | 18 | import java.io.IOException; 19 | 20 | import jakarta.servlet.ServletException; 21 | import jakarta.servlet.annotation.WebServlet; 22 | import jakarta.servlet.http.HttpServlet; 23 | import jakarta.servlet.http.HttpServletRequest; 24 | import jakarta.servlet.http.HttpServletResponse; 25 | 26 | /** 27 | * 28 | * @author Arjan Tijms 29 | * 30 | */ 31 | @WebServlet(urlPatterns = "/public/servlet") 32 | public class PublicServlet extends HttpServlet { 33 | 34 | private static final long serialVersionUID = 1L; 35 | 36 | @Override 37 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 38 | response.getWriter().write("This is a public servlet \n"); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /tck/status-codes/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | -------------------------------------------------------------------------------- /tck/status-codes/src/test/java/ee/jakarta/tck/authentication/test/statuscodes/PublicStatusCodesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.statuscodes; 17 | 18 | import static org.junit.Assert.assertEquals; 19 | 20 | import java.io.IOException; 21 | 22 | import org.jboss.arquillian.container.test.api.Deployment; 23 | import org.jboss.arquillian.junit.Arquillian; 24 | import org.jboss.shrinkwrap.api.Archive; 25 | import org.junit.Test; 26 | import org.junit.runner.RunWith; 27 | 28 | import ee.jakarta.tck.authentication.test.common.ArquillianBase; 29 | 30 | 31 | /** 32 | * This tests that a SAM can set a 404 response code when a public resource is requested. 33 | * Note the resource is not actual invoked, as the SAM returns SEND_FAILURE. 34 | * 35 | * @author Arjan Tijms 36 | * 37 | */ 38 | @RunWith(Arquillian.class) 39 | public class PublicStatusCodesTest extends ArquillianBase { 40 | 41 | @Deployment(testable = false) 42 | public static Archive createDeployment() { 43 | return defaultArchive(); 44 | } 45 | 46 | @Test 47 | public void test404inResponse() throws IOException { 48 | 49 | int code = getWebClient().getPage(getBase() + "public/servlet") 50 | .getWebResponse() 51 | .getStatusCode(); 52 | 53 | assertEquals( 54 | "Response should have 404 not found as status code, but did not.", 55 | 404, code 56 | ); 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /tck/wrapping/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 4.0.0 20 | 21 | 22 | org.eclipse.ee4j.tck.authentication 23 | jakarta-authentication-tck 24 | 3.1.0-SNAPSHOT 25 | 26 | 27 | wrapping 28 | war 29 | 30 | Jakarta Authentication TCK - wrapping 31 | 32 | 33 | 34 | org.jakartaee 35 | jaspic-common 36 | 1.0-SNAPSHOT 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tck/wrapping/src/main/java/ee/jakarta/tck/authentication/test/wrapping/sam/SamAutoRegistrationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.wrapping.sam; 17 | 18 | import static java.util.EnumSet.allOf; 19 | 20 | import ee.jakarta.tck.authentication.test.wrapping.servlet.ProgrammaticFilter; 21 | import jakarta.security.auth.message.config.AuthConfigFactory; 22 | import jakarta.servlet.DispatcherType; 23 | import jakarta.servlet.ServletContextEvent; 24 | import jakarta.servlet.ServletContextListener; 25 | import jakarta.servlet.annotation.WebListener; 26 | 27 | /** 28 | * 29 | * @author Arjan Tijms 30 | * 31 | */ 32 | @WebListener 33 | public class SamAutoRegistrationListener implements ServletContextListener { 34 | 35 | @Override 36 | public void contextInitialized(ServletContextEvent sce) { 37 | AuthConfigFactory.getFactory() 38 | .registerServerAuthModule(new TestWrappingServerAuthModule(), sce.getServletContext()); 39 | 40 | sce.getServletContext() 41 | .addFilter("Programmatic filter", ProgrammaticFilter.class) 42 | .addMappingForUrlPatterns(allOf(DispatcherType.class), false, "/*"); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /tck/wrapping/src/main/java/ee/jakarta/tck/authentication/test/wrapping/servlet/ProtectedServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.wrapping.servlet; 17 | 18 | import java.io.IOException; 19 | import java.io.Writer; 20 | 21 | import jakarta.servlet.ServletException; 22 | import jakarta.servlet.annotation.WebServlet; 23 | import jakarta.servlet.http.HttpServlet; 24 | import jakarta.servlet.http.HttpServletRequest; 25 | import jakarta.servlet.http.HttpServletResponse; 26 | 27 | /** 28 | * This Servlet tests that the request and response objects it receives are the ones marked as wrapped by the SAM that executed 29 | * before the Servlet was called. 30 | * 31 | * @author Arjan Tijms 32 | * 33 | */ 34 | @WebServlet(urlPatterns = "/protected/servlet") 35 | public class ProtectedServlet extends HttpServlet { 36 | 37 | private static final long serialVersionUID = 1L; 38 | 39 | @Override 40 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 41 | 42 | Writer writer = response.getWriter(); 43 | 44 | writer.write("servlet request isWrapped: " + request.getAttribute("isWrapped")); 45 | writer.write("\n"); 46 | writer.write("servlet response isWrapped: " + response.getHeader("isWrapped")); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /tck/wrapping/src/main/java/ee/jakarta/tck/authentication/test/wrapping/servlet/TestHttpServletRequestWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.wrapping.servlet; 17 | 18 | import jakarta.servlet.http.HttpServletRequest; 19 | import jakarta.servlet.http.HttpServletRequestWrapper; 20 | 21 | /** 22 | * 23 | * @author Arjan Tijms 24 | * 25 | */ 26 | public class TestHttpServletRequestWrapper extends HttpServletRequestWrapper { 27 | 28 | public TestHttpServletRequestWrapper(HttpServletRequest request) { 29 | super(request); 30 | } 31 | 32 | @Override 33 | public Object getAttribute(String name) { 34 | 35 | if ("isWrapped".equals(name)) { 36 | return Boolean.TRUE; 37 | } 38 | 39 | return super.getAttribute(name); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /tck/wrapping/src/main/java/ee/jakarta/tck/authentication/test/wrapping/servlet/TestHttpServletResponseWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022-2022 Contributors to the Eclipse Foundation 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0, which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, 11 | * version 2 with the GNU Classpath Exception, which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | */ 16 | package ee.jakarta.tck.authentication.test.wrapping.servlet; 17 | 18 | import jakarta.servlet.http.HttpServletResponse; 19 | import jakarta.servlet.http.HttpServletResponseWrapper; 20 | 21 | /** 22 | * 23 | * @author Arjan Tijms 24 | * 25 | */ 26 | public class TestHttpServletResponseWrapper extends HttpServletResponseWrapper { 27 | 28 | public TestHttpServletResponseWrapper(HttpServletResponse response) { 29 | super(response); 30 | } 31 | 32 | @Override 33 | public String getHeader(String name) { 34 | 35 | if ("isWrapped".equals(name)) { 36 | return "true"; 37 | } 38 | 39 | return super.getHeader(name); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /tck/wrapping/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | 23 | 24 | Test 25 | /protected/* 26 | 27 | 28 | architect 29 | 30 | 31 | 32 | 33 | architect 34 | 35 | 36 | --------------------------------------------------------------------------------