org.apache.openejb.cdi.ManagedSecurityService 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.openejb.cdi;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.spi.SecurityService;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.Principal;
import java.security.PrivilegedActionException;
import java.util.Properties;
public class ManagedSecurityService implements org.apache.webbeans.spi.SecurityService {
private final org.apache.webbeans.corespi.security.ManagedSecurityService delegate = new org.apache.webbeans.corespi.security.ManagedSecurityService();
@Override
public Principal getCurrentPrincipal() {
final SecurityService> service = SystemInstance.get().getComponent(SecurityService.class);
if (service != null) {
return service.getCallerPrincipal();
}
return null;
}
@Override
public Constructor doPrivilegedGetDeclaredConstructor(final Class clazz, final Class>... parameterTypes) {
return delegate.doPrivilegedGetDeclaredConstructor(clazz, parameterTypes);
}
@Override
public Constructor doPrivilegedGetConstructor(final Class clazz, final Class>... parameterTypes) {
return delegate.doPrivilegedGetConstructor(clazz, parameterTypes);
}
@Override
public Constructor>[] doPrivilegedGetDeclaredConstructors(final Class clazz) {
return delegate.doPrivilegedGetDeclaredConstructors(clazz);
}
@Override
public Method doPrivilegedGetDeclaredMethod(final Class clazz, final String name, final Class>... parameterTypes) {
return delegate.doPrivilegedGetDeclaredMethod(clazz, name, parameterTypes);
}
@Override
public Method[] doPrivilegedGetDeclaredMethods(final Class clazz) {
return delegate.doPrivilegedGetDeclaredMethods(clazz);
}
@Override
public Field doPrivilegedGetDeclaredField(final Class clazz, final String name) {
return delegate.doPrivilegedGetDeclaredField(clazz, name);
}
@Override
public Field[] doPrivilegedGetDeclaredFields(final Class clazz) {
return delegate.doPrivilegedGetDeclaredFields(clazz);
}
@Override
public void doPrivilegedSetAccessible(final AccessibleObject obj, final boolean flag) {
delegate.doPrivilegedSetAccessible(obj, flag);
}
@Override
public boolean doPrivilegedIsAccessible(final AccessibleObject obj) {
return delegate.doPrivilegedIsAccessible(obj);
}
@Override
public T doPrivilegedObjectCreate(final Class clazz) throws PrivilegedActionException, IllegalAccessException, InstantiationException {
return delegate.doPrivilegedObjectCreate(clazz);
}
@Override
public void doPrivilegedSetSystemProperty(final String propertyName, final String value) {
delegate.doPrivilegedSetSystemProperty(propertyName, value);
}
@Override
public String doPrivilegedGetSystemProperty(final String propertyName, final String defaultValue) {
return delegate.doPrivilegedGetSystemProperty(propertyName, propertyName);
}
@Override
public Properties doPrivilegedGetSystemProperties() {
return delegate.doPrivilegedGetSystemProperties();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy