i'm using apache camel and i want to instantiate java class in blueprint.xml
this is the constructor of the class:
public class ShiroSecurityPolicy implements AuthorizationPolicy {
private static final Logger LOG = LoggerFactory.getLogger(ShiroSecurityPolicy.class);
private final byte[] bits128 = {
(byte) 0x08, (byte) 0x09, (byte) 0x0A, (byte) 0x0B,
(byte) 0x0C, (byte) 0x0D, (byte) 0x0E, (byte) 0x0F,
(byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x13,
(byte) 0x14, (byte) 0x15, (byte) 0x16, (byte) 0x17};
private CipherService cipherService;
private byte[] passPhrase;
private SecurityManager securityManager;
private List<Permission> permissionsList;
private boolean alwaysReauthenticate;
private boolean base64;
public ShiroSecurityPolicy(String iniResourcePath, byte[] passPhrase, boolean alwaysReauthenticate, List<Permission> permissionsList)
{
this(iniResourcePath, passPhrase, alwaysReauthenticate);
this.setPermissionsList(permissionsList);
}
........
How can i instantiate it in blueprint.xml ?
this is what i did :
<bean id="shiroPolicy" class="org.apache.camel.component.shiro.security.ShiroSecurityPolicy">
<argument value="shiro.ini"/>
...
</bean>
but what i put for passPhrase (which is an Array) and permissionsList (which is a List) argument ?
List:
<argument>
<list>
<value>item1</value>
<value>item2</value>
<value>item3</value>
</list>
</argument>
Array:
<argument>
<array>
<value>item1</value>
<value>item2</value>
<value>item3</value>
</array>
</argument>
You can use constructor public ShiroSecurityPolicy(String iniResourcePath)
and inject passPhrase and permissionsList like bean's properties.
If I'm not mistaken, permissionsList can be specified in ini file: http://shiro.apache.org/configuration.html
UPDATED:
Try to set permission list like here:
<argument>
<list>
<bean class="org.apache.shiro.authz.permission.WildcardPermission">
<argument value="zone1"/>
</bean>
</list>
</argument>