Java Code Examples for org.jboss.security.SecurityConstants#DEFAULT_APPLICATION_POLICY

The following examples show how to use org.jboss.security.SecurityConstants#DEFAULT_APPLICATION_POLICY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JBossMappingManager.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public <T> MappingContext<T> getMappingContext(String mappingType)
{
   //Apply Mapping Logic
   ApplicationPolicy aPolicy = SecurityConfiguration.getApplicationPolicy(securityDomain);

   if(aPolicy == null)
   {
      String defaultDomain = SecurityConstants.DEFAULT_APPLICATION_POLICY;
      aPolicy = SecurityConfiguration.getApplicationPolicy(defaultDomain);
   }
   if(aPolicy == null )
      throw PicketBoxMessages.MESSAGES.failedToObtainApplicationPolicy(securityDomain);

   MappingContext<T> mc = null;
   MappingInfo rmi = aPolicy.getMappingInfo(mappingType);

   if( rmi != null)
      mc = generateMappingContext(mc, rmi);

   return mc;
}
 
Example 2
Source File: JBossMappingManager.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public <T> MappingContext<T> getMappingContext(Class<T> mappingType)
{
   //Apply Mapping Logic
   ApplicationPolicy aPolicy = SecurityConfiguration.getApplicationPolicy(securityDomain);

   if(aPolicy == null)
   {
      String defaultDomain = SecurityConstants.DEFAULT_APPLICATION_POLICY;
      aPolicy = SecurityConfiguration.getApplicationPolicy(defaultDomain);
   }
   if(aPolicy == null )
      throw PicketBoxMessages.MESSAGES.failedToObtainApplicationPolicy(securityDomain);

   MappingContext<T> mc = null;
   MappingInfo rmi = aPolicy.getMappingInfo(mappingType);
   if( rmi != null)
     mc = generateMappingContext(mc, rmi);

   return mc;
}
 
Example 3
Source File: JBossAuthorizationContext.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private AuthorizationInfo getAuthorizationInfo(ResourceType layer)
{
   AuthorizationInfo ai = null;

   if (layer == ResourceType.EJB)
      ai = SecurityConfiguration.getApplicationPolicy(EJB).getAuthorizationInfo();
   else if (layer == ResourceType.WEB)
      ai = SecurityConfiguration.getApplicationPolicy(WEB).getAuthorizationInfo();
   else
   {
      ai = new AuthorizationInfo(SecurityConstants.DEFAULT_APPLICATION_POLICY);
      ai.add(new AuthorizationModuleEntry(DelegatingAuthorizationModule.class.getName()));
   }
   return ai;
}
 
Example 4
Source File: JBossSecuritySubjectFactory.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @see SubjectFactory#createSubject(String)
 */
public Subject createSubject(String securityDomainName)
{
   if (securityManagement == null)
   {
      PicketBoxLogger.LOGGER.warnSecurityMagementNotSet();
      securityManagement = new DefaultSecurityManagement(new JBossCallbackHandler());
   }
   Subject subject = new Subject();
   //Validate the caller
   Principal principal = SubjectActions.getPrincipal();
   AuthenticationManager authenticationManager = securityManagement.getAuthenticationManager(securityDomainName);
   if (authenticationManager == null)
   {
      String defaultSecurityDomain = SecurityConstants.DEFAULT_APPLICATION_POLICY;
      PicketBoxLogger.LOGGER.debugNullAuthenticationManager(securityDomainName);
      authenticationManager = securityManagement.getAuthenticationManager(defaultSecurityDomain);
   }
   //AS7-1072: we can't have TCCL null or else LoginContext can't find the login modules
   ClassLoader tccl = SubjectActions.getContextClassLoader();
   try
   {
      SubjectActions.setContextClassLoader(this.getClass().getClassLoader());
      if (!authenticationManager.isValid(principal, SubjectActions.getCredential(), subject))
      {
         LoginException loginException = SubjectActions.getContextLoginException();
         if (loginException == null) {
             throw new SecurityException(PicketBoxMessages.MESSAGES.authenticationFailedMessage());
         }
         else
         {
             throw new SecurityException(PicketBoxMessages.MESSAGES.authenticationFailedMessage(), loginException);
         }
      }
   }
   finally
   {
      SubjectActions.setContextClassLoader(tccl);
   }
   return subject;
}
 
Example 5
Source File: JaasSecurityManagerBase.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/** Creates a default JaasSecurityManager for with a securityDomain
 name of 'other'.
 */
public JaasSecurityManagerBase()
{
   this(SecurityConstants.DEFAULT_APPLICATION_POLICY, new JBossCallbackHandler());
}