// get the metadata for the authentication policy bean.
String authPolicyName = this.policyName + "$AuthenticationPolicy";
result.addAll(this.authMetaData.getBeans(authPolicyName, AuthenticationPolicyBean.class.getName()));
// inject the authentication policy into the application policy.
ValueMetaData injectAuthenticationPolicy = policyBuilder.createInject(authPolicyName);
policyBuilder.addPropertyMetaData("authenticationPolicy", injectAuthenticationPolicy);
}
else if (this.jaspiMetaData != null)
{
logger.trace("Generating jaspi-authentication metadata for policy " + this.policyName);
// get the metadata for the jaspi authentication policy bean.
String authPolicyName = this.policyName + "$JASPIAuthenticationPolicy";
result.addAll(this.jaspiMetaData.getBeans(authPolicyName, JASPIAuthenticationPolicyBean.class.getName()));
// inject the jaspi authentication policy into the application policy.
ValueMetaData injectAuthenticationPolicy = policyBuilder.createInject(authPolicyName);
policyBuilder.addPropertyMetaData("authenticationPolicy", injectAuthenticationPolicy);
}
// if no authentication configuration was found and the policy does not extend another policy, throw an exception.
else if (this.parentPolicy == null)
{
throw new RuntimeException(
"An application policy must have an authentication or authentication-jaspi configuration");
}
// authorization metadata.
if (this.authzMetaData != null)
{
logger.trace("Generating authorization metadata for policy " + this.policyName);
// get the metadata for the authorization policy bean.
String authzPolicyName = this.policyName + "$AuthorizationPolicy";
result.addAll(this.authzMetaData.getBeans(authzPolicyName, AuthorizationPolicyBean.class.getName()));
// inject the authorization policy into the application policy.
ValueMetaData injectAuthorizationPolicy = policyBuilder.createInject(authzPolicyName);
policyBuilder.addPropertyMetaData("authorizationPolicy", injectAuthorizationPolicy);
}
// acl (instance-based authorization) metadata.
if (this.aclMetaData != null)
{
logger.trace("Generating acl metadata for policy " + this.policyName);
// get the metadata for the acl policy bean.
String aclPolicyName = this.policyName + "$ACLPolicy";
result.addAll(this.aclMetaData.getBeans(aclPolicyName, ACLPolicyBean.class.getName()));
// inject the authorization policy into the application policy.
ValueMetaData injectACLPolicy = policyBuilder.createInject(aclPolicyName);
policyBuilder.addPropertyMetaData("aclPolicy", injectACLPolicy);
}
// role-mapping metadata.
if (this.roleMappingMetaData != null)
{
logger.trace("Generating role-mapping metadata for policy " + this.policyName);
// get the metadata for the role-mapping policy bean.
String mappingPolicyName = this.policyName + "$RoleMappingPolicy";
result.addAll(this.roleMappingMetaData.getBeans(mappingPolicyName, MappingPolicyBean.class.getName()));
// inject the role-mapping policy into the application policy.
ValueMetaData injectMappingPolicy = policyBuilder.createInject(mappingPolicyName);
policyBuilder.addPropertyMetaData("roleMappingPolicy", injectMappingPolicy);
}
// generic mapping metadata.
if (this.mappingMetaData != null)
{
logger.trace("Generating mapping metadata for policy " + this.policyName);
// get the metadata for the mapping policy bean.
String mappingPolicyName = this.policyName + "$MappingPolicy";
result.addAll(this.mappingMetaData.getBeans(mappingPolicyName, MappingPolicyBean.class.getName()));
// inject the mapping policy into the application policy.
ValueMetaData injectMappingPolicy = policyBuilder.createInject(mappingPolicyName);
policyBuilder.addPropertyMetaData("mappingPolicy", injectMappingPolicy);
}
// audit metadata.
if (this.auditMetaData != null)
{
logger.trace("Generating audit metadata for policy " + this.policyName);
// get the metadata for the audit policy bean.
String auditPolicyName = this.policyName + "$AuditPolicy";
result.addAll(this.auditMetaData.getBeans(auditPolicyName, AuditPolicyBean.class.getName()));
// inject the audit policy into the application policy.
ValueMetaData injectAuditPolicy = policyBuilder.createInject(auditPolicyName);
policyBuilder.addPropertyMetaData("auditPolicy", injectAuditPolicy);
}
// identity-trust metadata.
if (this.trustMetaData != null)
{
logger.trace("Generating identity-trust metadata for policy " + this.policyName);
// get the metadata for the identity-trust policy bean.
String trustPolicyName = this.policyName + "$IdentityTrustPolicy";
result.addAll(this.trustMetaData.getBeans(trustPolicyName, IdentityTrustPolicyBean.class.getName()));
// inject the identity-trust policy into the application policy.
ValueMetaData injectIdentityTrustPolicy = policyBuilder.createInject(trustPolicyName);
policyBuilder.addPropertyMetaData("identityTrustPolicy", injectIdentityTrustPolicy);
}
// inject the security management bean.
logger.trace("Injecting security management " + this.securityManagement + " into application-policy metadata");
ValueMetaData injectManagement = policyBuilder.createInject(this.securityManagement);
policyBuilder.addPropertyMetaData("securityManagement", injectManagement);
return result;
}