cmrockwell commented on a change in pull request #51: SAML2 Service Provider 
Pull Request
URL: https://github.com/apache/sling-whiteboard/pull/51#discussion_r403347194
 
 

 ##########
 File path: 
saml-handler/src/main/java/org/apache/sling/auth/saml2/AuthenticationHandlerSAML2.java
 ##########
 @@ -0,0 +1,661 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sling.auth.saml2;
+
+import 
net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.xml.ParserPool;
+import org.apache.jackrabbit.api.security.user.User;
+import org.apache.sling.auth.core.AuthUtil;
+import org.apache.sling.auth.saml2.idp.IDPCredentials;
+import org.apache.sling.auth.saml2.impl.SAML2ConfigServiceImpl;
+import org.apache.sling.auth.saml2.impl.Saml2Credentials;
+import org.apache.sling.auth.saml2.sp.SPCredentials;
+import org.apache.sling.auth.saml2.sync.Saml2User;
+import org.joda.time.DateTime;
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
+import org.opensaml.core.xml.schema.XSString;
+import org.opensaml.messaging.context.MessageContext;
+import org.opensaml.messaging.decoder.MessageDecodingException;
+import org.opensaml.messaging.encoder.MessageEncodingException;
+import org.opensaml.saml.common.messaging.context.SAMLBindingContext;
+import org.opensaml.saml.common.messaging.context.SAMLEndpointContext;
+import org.opensaml.saml.common.messaging.context.SAMLPeerEntityContext;
+import org.opensaml.saml.saml2.binding.decoding.impl.HTTPPostDecoder;
+import 
org.opensaml.saml.saml2.binding.encoding.impl.HTTPRedirectDeflateEncoder;
+import org.opensaml.saml.saml2.core.*;
+import org.opensaml.saml.common.xml.SAMLConstants;
+import org.opensaml.saml.saml2.encryption.Decrypter;
+import org.opensaml.saml.saml2.metadata.Endpoint;
+import org.opensaml.saml.saml2.metadata.SingleSignOnService;
+import org.opensaml.saml.security.impl.SAMLSignatureProfileValidator;
+import org.opensaml.xmlsec.SignatureSigningParameters;
+import org.opensaml.xmlsec.context.SecurityParametersContext;
+import org.opensaml.xmlsec.encryption.support.DecryptionException;
+import org.opensaml.xmlsec.encryption.support.InlineEncryptedKeyResolver;
+import org.opensaml.xmlsec.keyinfo.impl.StaticKeyInfoCredentialResolver;
+import org.opensaml.xmlsec.signature.support.SignatureConstants;
+import org.opensaml.xmlsec.signature.support.SignatureException;
+import org.opensaml.xmlsec.signature.support.SignatureValidator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.wiring.BundleWiring;
+import org.apache.sling.auth.core.spi.AuthenticationHandler;
+import org.apache.sling.auth.core.spi.AuthenticationInfo;
+import org.apache.sling.auth.core.spi.DefaultAuthenticationFeedbackHandler;
+import org.apache.sling.auth.saml2.sp.SessionStorage;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.jcr.RepositoryException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.math.BigInteger;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import static 
org.apache.sling.auth.saml2.idp.Saml2IDPServlet.TEST_IDP_ENDPOINT;
+
+
+@Component(
+        service = AuthenticationHandler.class ,
+        name = AuthenticationHandlerSAML2.SERVICE_NAME,
+        configurationPid = 
"org.apache.sling.auth.saml2.impl.SAML2ConfigServiceImpl",
+        configurationPolicy = ConfigurationPolicy.REQUIRE,
+        property = {"sling.servlet.methods={GET, POST}",
+            AuthenticationHandler.PATH_PROPERTY+"={}",
+            AuthenticationHandler.TYPE_PROPERTY + "=" + 
AuthenticationHandlerSAML2.AUTH_TYPE,
+            "service.description=SAML2 Authentication Handler",
+            "service.ranking=42",
 
 Review comment:
   haha sort of, yeah. When I first started, I could not get Sling to use this 
authHandler. I tried high and low numbers, but only the form handler would get 
used. it seems only path length really has an impact in terms of which 
authentication handler 'wins' Since the service ranking seemed ineffective, I 
set it to a low but unique number between 0 and 500 lol

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to