当前位置: 首页>>代码示例>>Java>>正文


Java UnavailableSecurityManagerException类代码示例

本文整理汇总了Java中org.apache.shiro.UnavailableSecurityManagerException的典型用法代码示例。如果您正苦于以下问题:Java UnavailableSecurityManagerException类的具体用法?Java UnavailableSecurityManagerException怎么用?Java UnavailableSecurityManagerException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UnavailableSecurityManagerException类属于org.apache.shiro包,在下文中一共展示了UnavailableSecurityManagerException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveSecurityManager

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
public SecurityManager resolveSecurityManager() {
    SecurityManager securityManager = getSecurityManager();
    if (securityManager == null) {
        if (log.isDebugEnabled()) {
            log.debug("No SecurityManager available in subject context map.  " +
                    "Falling back to SecurityUtils.getSecurityManager() lookup.");
        }
        try {
            securityManager = SecurityUtils.getSecurityManager();
        } catch (UnavailableSecurityManagerException e) {
            if (log.isDebugEnabled()) {
                log.debug("No SecurityManager available via SecurityUtils.  Heuristics exhausted.", e);
            }
        }
    }
    return securityManager;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:18,代码来源:DefaultSubjectContext.java

示例2: checkSubjectIs

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
private void checkSubjectIs(String id) {
    try {
        Subject subject = SecurityUtils.getSubject();
        if (subject.isAuthenticated()) {
            if (id.equals( ((UserInfo)subject.getPrincipal()).getOpenid() ) || subject.hasRole(RegAuthorizationInfo.ADMINSTRATOR_ROLE) ) {
                return;
            } else {
                throw new AuthorizationException("Cannot change credentials for another user");
            }
        } else {
            throw new UnauthenticatedException();
        }
    } catch (UnavailableSecurityManagerException e) {
        // Allow to proceed if no security system is configured
    }
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:17,代码来源:BaseUserStore.java

示例3: getRequestor

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
public static String getRequestor(HttpServletRequest request) {
    try {
        UserInfo user = (UserInfo) SecurityUtils.getSubject().getPrincipal();
        if (user != null) {
            return NameUtils.encodeSafeName(user.toString());
        }
    } catch (UnavailableSecurityManagerException e) {
        // shiro not running, presumably test mode, fall through to default requestor based on IP
    }

    if (request.getHeader(FORWARDED_FOR_HEADER) != null) {
        return request.getHeader(FORWARDED_FOR_HEADER);
    }

    return request.getRemoteAddr();
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:17,代码来源:RequestProcessor.java

示例4: isAuthorized

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
/**
 * Test if the user of authorized to execute this command
 */
public boolean isAuthorized() {
    RegPermission required = permissionRequired();
    if (required != null) {
        try {
            Subject subject = SecurityUtils.getSubject();
            if (subject.isPermitted(required)) {
                return true;
            } else {
                log.warn("Authorization failure for " + subject.getPrincipal() + ", requested permission " + required);
                return false;
            }
        } catch (UnavailableSecurityManagerException e) {
            log.warn("Security is not configured, assuming test mode");
            return true;
        }
    } else {
        return true;
    }
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:23,代码来源:Command.java

示例5: tearDownShiro

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
/**
 * Method description
 *
 */
private void tearDownShiro()
{
  try
  {
    SecurityManager securityManager = SecurityUtils.getSecurityManager();

    LifecycleUtils.destroy(securityManager);
    ThreadContext.unbindSecurityManager();
    ThreadContext.unbindSubject();
    ThreadContext.remove();
  }
  catch (UnavailableSecurityManagerException e)
  {

    // we don't care about this when cleaning up the test environment
    // (for example, maybe the subclass is a unit test and it didn't
    // need a SecurityManager instance because it was using only mock Subject instances)
  }

  SecurityUtils.setSecurityManager(null);
}
 
开发者ID:sdorra,项目名称:shiro-unit,代码行数:26,代码来源:ShiroRule.java

示例6: tearDownShiro

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
@AfterClass
public static void tearDownShiro() {
    doClearSubject();

    try {
        org.apache.shiro.mgt.SecurityManager securityManager = SecurityUtils.getSecurityManager();
        LifecycleUtils.destroy( securityManager );
    }
    catch ( UnavailableSecurityManagerException e ) {
        // we don't care about this when cleaning up the test environment
        // (for example, maybe the subclass is a unit test and it didn't
        // need a SecurityManager instance because it was using only
        // mock Subject instances)
    }
    SecurityUtils.setSecurityManager( null );
}
 
开发者ID:apache,项目名称:usergrid,代码行数:17,代码来源:CustomResolverTest.java

示例7: getSession

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
public Session getSession() {
	Session session = null;
	try {
		Subject subject = SecurityUtils.getSubject();
		session = subject.getSession(false);
		if (session == null) {
			session = subject.getSession();
		}
	} catch (InvalidSessionException e) {
		logger.error("Invalid session error", e);
	} catch (UnavailableSecurityManagerException e2) {
		logger.error("Unavailable SecurityManager error", e2);
	}
	return session;
}
 
开发者ID:funtl,项目名称:framework,代码行数:16,代码来源:SessionCacheManager.java

示例8: isIntegratedSecurity

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
/**
 * check if Shiro's security manager is configured
 * 
 * @return true if configured, false if not
 */
public boolean isIntegratedSecurity() {
  if (isIntegratedSecurity != null) {
    return isIntegratedSecurity;
  }

  try {
    isIntegratedSecurity = (SecurityUtils.getSecurityManager() != null);
  } catch (UnavailableSecurityManagerException e) {
    isIntegratedSecurity = false;
  }
  return isIntegratedSecurity;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:IntegratedSecurityService.java

示例9: getSession

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
public Session getSession(){
	Session session = null;
	try{
		Subject subject = SecurityUtils.getSubject();
		session = subject.getSession(false);
		if (session == null){
			session = subject.getSession();
		}
	}catch (InvalidSessionException e){
		logger.error("Invalid session error", e);
	}catch (UnavailableSecurityManagerException e2){
		logger.error("Unavailable SecurityManager error", e2);
	}
	return session;
}
 
开发者ID:egojit8,项目名称:easyweb,代码行数:16,代码来源:SessionCacheManager.java

示例10: tearDownShiro

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
@AfterClass
public static void tearDownShiro() {
	doClearSubject();
	try {
		SecurityManager securityManager = getSecurityManager();
		LifecycleUtils.destroy(securityManager);
	} catch (UnavailableSecurityManagerException e) {
		//we don't care about this when cleaning up the test environment
		//(for example, maybe the subclass is a unit test and it didn't
		// need a SecurityManager instance because it was using only
		// mock Subject instances)
	}
	setSecurityManager(null);
}
 
开发者ID:usydapeng,项目名称:thymeleaf3-shiro,代码行数:15,代码来源:AbstractShiroTest.java

示例11: tearDownShiro

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
@AfterClass
public static void tearDownShiro() {
    doClearSubject();
    try {
        SecurityManager securityManager = getSecurityManager();
        LifecycleUtils.destroy(securityManager);
    } catch (UnavailableSecurityManagerException e) {
        //we don't care about this when cleaning up the test environment
        //(for example, maybe the subclass is a unit test and it didn't
        // need a SecurityManager instance because it was using only
        // mock Subject instances)
    }
    setSecurityManager(null);
}
 
开发者ID:izhangzhihao,项目名称:SpringMVCSeedProject,代码行数:15,代码来源:AbstractShiroTest.java

示例12: getPrincipalName

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
private String getPrincipalName(){
	try {
		if (SecurityUtils.getSubject() == null || SecurityUtils.getSubject().getPrincipal() == null) return "Unauthenticated";
		return SecurityUtils.getSubject().getPrincipal().toString();
	} catch (UnavailableSecurityManagerException e) {
		log.warn("Audit being called with no valid security context. This is probably caused by being called from unit tests");
		return "Security Manager Not Configured";
	}
}
 
开发者ID:ox-it,项目名称:ords-database-api,代码行数:10,代码来源:DatabaseAuditServiceImpl.java

示例13: checkSecurityManager

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
/**
 * Called once the server has started to check the security manager.
 */
protected void checkSecurityManager() {
  try {
    if (AuthUtils.isDefault()) {
      _logger.logWarn("*****************************************************************");
      _logger.logWarn(" Warning: Server running with default permissive SecurityManager ");
      _logger.logWarn("*****************************************************************");
    }
  } catch (UnavailableSecurityManagerException ex) {
    _logger.logError("***************************************************");
    _logger.logError(" Error: Server running without any SecurityManager ");
    _logger.logError("***************************************************");
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:17,代码来源:OpenGammaComponentServer.java

示例14: createDefaultInstance

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
@Override
protected SecurityManager createDefaultInstance() {
  try {
    SecurityManager sm = AuthUtils.getSecurityManager();
    if (sm instanceof WebSecurityManager) {
      return sm;
    }
    return super.createDefaultInstance();
    
  } catch (UnavailableSecurityManagerException ex) {
    return super.createDefaultInstance();
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:14,代码来源:ShiroSecurityEnvironmentLoader.java

示例15: isRememberMe

import org.apache.shiro.UnavailableSecurityManagerException; //导入依赖的package包/类
@Override
public boolean isRememberMe() {
    try {
        return getAuthentication().isRemembered();
    } catch (final UnavailableSecurityManagerException e) {
        return false;
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:9,代码来源:ShiroAuthenticationService.java


注:本文中的org.apache.shiro.UnavailableSecurityManagerException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。