All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.geronimo.tomcat.EjbWsContextConfig Maven / Gradle / Ivy

The newest version!
/*
 * 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.geronimo.tomcat;

import java.security.AccessControlContext;

import javax.security.auth.Subject;

import org.apache.geronimo.security.jaas.ConfigurationFactory;
import org.apache.geronimo.tomcat.security.Authorizer;
import org.apache.geronimo.tomcat.security.jacc.JACCAuthorizer;
import org.apache.geronimo.tomcat.security.jacc.JACCEJBWebServiceAuthorizer;
import org.apache.catalina.core.StandardContext;

/**
 * @version $Rev: 797771 $ $Date: 2009-07-25 22:17:37 +0800 (Sat, 25 Jul 2009) $
 */
public class EjbWsContextConfig extends BaseGeronimoContextConfig {
    private final String policyContextId;
    private final ConfigurationFactory configurationFactory;
    private final Subject defaultSubject;
    private final String authMethod;
    private final String realmName;

    public EjbWsContextConfig(String policyContextId, ConfigurationFactory configurationFactory, Subject defaultSubject, String authMethod, String realmName) {
        this.policyContextId = policyContextId;
        this.configurationFactory = configurationFactory;
        this.defaultSubject = defaultSubject;
        this.authMethod = authMethod;
        this.realmName = realmName;
    }

    @Override
    protected void authenticatorConfig() {
        if (policyContextId == null || configurationFactory == null) {
            return;
        }

        configureSecurity((StandardContext)context,
                policyContextId,
                configurationFactory,
                defaultSubject,
                authMethod, realmName, null, null);
    }

    protected Authorizer createAuthorizer(AccessControlContext defaultAcc) {
        return new JACCEJBWebServiceAuthorizer(defaultAcc);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy