Search in sources :

Example 1 with EJSpringSecurityConfigProvider

use of org.entirej.applicationframework.rwt.spring.ext.EJSpringSecurityConfigProvider in project rap by entirej.

the class EJSpringRestSecurityConfig method getProvider.

private static EJSpringSecurityConfigProvider getProvider() {
    EJCoreProperties instance = EJCoreProperties.getInstance();
    EJFrameworkExtensionProperties definedProperties = instance.getApplicationDefinedProperties();
    if (definedProperties != null) {
        EJFrameworkExtensionProperties settings = definedProperties.getPropertyGroup(SPRING_SECURITY);
        if (settings != null) {
            String configClass = settings.getStringProperty(SPRING_SECURITY_AUTH);
            if (configClass != null && !configClass.isEmpty()) {
                Class<?> factoryClass;
                try {
                    factoryClass = Class.forName(configClass);
                    Object obj = factoryClass.newInstance();
                    if (obj instanceof EJSpringSecurityConfigProvider) {
                        return (EJSpringSecurityConfigProvider) obj;
                    } else {
                        System.err.println("invalid EJSpringSecurityConfigProvider switch to default");
                    }
                } catch (ClassNotFoundException e) {
                    System.err.println("invalid EJSpringSecurityConfigProvider switch to default");
                    e.printStackTrace();
                } catch (InstantiationException e) {
                    System.err.println("invalid EJSpringSecurityConfigProvider switch to default");
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    System.err.println("invalid EJSpringSecurityConfigProvider switch to default");
                    e.printStackTrace();
                }
            }
        }
    }
    return new EJDefaultSpringSecurityConfigProvider();
}
Also used : EJSpringSecurityConfigProvider(org.entirej.applicationframework.rwt.spring.ext.EJSpringSecurityConfigProvider) EJDefaultSpringSecurityConfigProvider(org.entirej.applicationframework.rwt.spring.ext.EJDefaultSpringSecurityConfigProvider) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) EJCoreProperties(org.entirej.framework.core.properties.EJCoreProperties)

Aggregations

EJDefaultSpringSecurityConfigProvider (org.entirej.applicationframework.rwt.spring.ext.EJDefaultSpringSecurityConfigProvider)1 EJSpringSecurityConfigProvider (org.entirej.applicationframework.rwt.spring.ext.EJSpringSecurityConfigProvider)1 EJCoreProperties (org.entirej.framework.core.properties.EJCoreProperties)1 EJFrameworkExtensionProperties (org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties)1