本文整理汇总了Java中org.springframework.security.access.vote.RoleVoter类的典型用法代码示例。如果您正苦于以下问题:Java RoleVoter类的具体用法?Java RoleVoter怎么用?Java RoleVoter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RoleVoter类属于org.springframework.security.access.vote包,在下文中一共展示了RoleVoter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postProcessAfterInitialization
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
throws BeansException {
// remove this if you are not using JSR-250
if(bean instanceof Jsr250MethodSecurityMetadataSource) {
((Jsr250MethodSecurityMetadataSource) bean).setDefaultRolePrefix(null);
}
if(bean instanceof DefaultMethodSecurityExpressionHandler) {
((DefaultMethodSecurityExpressionHandler) bean).setDefaultRolePrefix(null);
}
if(bean instanceof DefaultWebSecurityExpressionHandler) {
((DefaultWebSecurityExpressionHandler) bean).setDefaultRolePrefix(null);
}
if(bean instanceof SecurityContextHolderAwareRequestFilter) {
((SecurityContextHolderAwareRequestFilter)bean).setRolePrefix("");
}
if(bean instanceof RoleVoter){
((RoleVoter) bean).setRolePrefix("");
}
return bean;
}
示例2: accessDecisionManager
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
@Bean
public AccessDecisionManager accessDecisionManager() {
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>();
decisionVoters.add(new RoleVoter());
decisionVoters.add(new AuthenticatedVoter());
decisionVoters.add(webExpressionVoter());
return new AffirmativeBased(decisionVoters);
}
示例3: accessDecisionManager2
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
public AccessDecisionManager accessDecisionManager2(
CustomWebSecurityExpressionHandler customWebSecurityExpressionHandler) {
List<AccessDecisionVoter<? extends Object>> decisionVoters
= Arrays.asList(
new AuthenticatedVoter(),
new RoleVoter(),
new WebExpressionVoter(){{
setExpressionHandler(customWebSecurityExpressionHandler);
}}
);
return new UnanimousBased(decisionVoters);
}
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:13,代码来源:CustomAuthorizationConfig.java
示例4: shellAccessDecisionManager
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
@Bean
public AccessDecisionManager shellAccessDecisionManager() {
List<AccessDecisionVoter<?>> voters = new ArrayList<AccessDecisionVoter<?>>();
RoleVoter voter = new RoleVoter();
voter.setRolePrefix("");
voters.add(voter);
return new UnanimousBased(voters);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:CrshAutoConfigurationTests.java
示例5: accessDecisionManager
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
/**
* Overridden to remove role prefix for the role voter. The application does not require any other access decision voters in the default configuration.
*/
/*
* rawtypes must be suppressed because AffirmativeBased constructor takes in a raw typed list of AccessDecisionVoters
*/
@SuppressWarnings("rawtypes")
@Override
protected AccessDecisionManager accessDecisionManager()
{
List<AccessDecisionVoter<?>> decisionVoters = new ArrayList<>();
RoleVoter decisionVoter = new RoleVoter();
decisionVoter.setRolePrefix("");
decisionVoters.add(decisionVoter);
return new AffirmativeBased(decisionVoters);
}
示例6: init
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
@PostConstruct
public void init() {
if (this.accessDecisionManager == null) {
if (log.isDebugEnabled())
log.debug("Creating default AffirmativeBased AccesDecisionManager with RoleVoter");
List<AccessDecisionVoter<? extends Object>> defaultVoters =
new ArrayList<AccessDecisionVoter<? extends Object>>();
defaultVoters.add(new RoleVoter());
this.accessDecisionManager = new AffirmativeBased(defaultVoters);
}
}
示例7: getRoleVoter
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
@Bean
public RoleVoter getRoleVoter() {
return new AdminRoleVoter();
}
示例8: addFilterSecurityInterceptor
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
private void addFilterSecurityInterceptor(List<Filter> filters, MotechURLSecurityRule securityRule) {
Map<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
List<AccessDecisionVoter> voters = new ArrayList<>();
Collection<ConfigAttribute> configAtts = new ArrayList<>();
if (CollectionUtils.isEmpty(securityRule.getPermissionAccess()) && CollectionUtils.isEmpty(securityRule.getUserAccess())) {
configAtts.add(new SecurityConfig("IS_AUTHENTICATED_FULLY"));
AuthenticatedVoter authVoter = new AuthenticatedVoter();
voters.add(authVoter);
} else {
if (!CollectionUtils.isEmpty(securityRule.getPermissionAccess())) {
for (String permission : securityRule.getPermissionAccess()) {
configAtts.add(new SecurityConfig(permission));
}
}
if (!CollectionUtils.isEmpty(securityRule.getUserAccess())) {
for (String userAccess : securityRule.getUserAccess()) {
configAtts.add(new SecurityConfig(SecurityConfigConstants.USER_ACCESS_PREFIX + userAccess));
}
}
}
buildRequestMap(requestMap, configAtts, securityRule);
FilterInvocationSecurityMetadataSource metadataSource = new DefaultFilterInvocationSecurityMetadataSource((LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>) requestMap);
FilterSecurityInterceptor interceptor = new FilterSecurityInterceptor();
interceptor.setSecurityMetadataSource(metadataSource);
RoleVoter roleVoter = new RoleVoter();
roleVoter.setRolePrefix(SecurityConfigConstants.ROLE_ACCESS_PREFIX);
voters.add(roleVoter);
voters.add(new MotechAccessVoter());
AccessDecisionManager decisionManager = new AffirmativeBased(voters);
interceptor.setAccessDecisionManager(decisionManager);
interceptor.setAuthenticationManager(authenticationManager);
filters.add(interceptor);
}
示例9: roleVoter
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
@Bean
public RoleVoter roleVoter() {
return new RoleHierarchyVoter(roleHierarchy());
}
示例10: roleVoter
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
@Bean
public RoleVoter roleVoter()
{
return new RoleHierarchyVoter(roleHierarchy());
}
示例11: getRoleVoter
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
@Bean
public RoleVoter getRoleVoter() {
RoleVoter roleVoter = new RoleVoter();
roleVoter.setRolePrefix("ROLE _");
return roleVoter;
}
开发者ID:jacek99,项目名称:dropwizard-spring-di-security-onejar-example,代码行数:7,代码来源:MyAppSpringConfiguration.java
示例12: init
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
/**
* Initializarea contextului. Aici se preiau nomenclatoarele ce se vor
* pastra pe sesiune
*/
public void init(ServletConfig conf) throws ServletException {
logger.info("Initializare aplicatie...");
try {
ServletContext sc = conf.getServletContext();
logger.info("*******************************************************");
logger.info("* *");
logger.info("* INITIATING APPLICATION CLIENT MANAGEMENT-> *");
logger.info("* *");
logger.info("*******************************************************");
logger.info(IConstant.APP_VERSION.concat("/").concat(IConstant.APP_RELEASE_DATE));
sc.setAttribute("VERSION", IConstant.APP_VERSION);
sc.setAttribute("RELEASE_DATE", IConstant.APP_RELEASE_DATE);
sc.setAttribute("RELEASE_YEAR", IConstant.APP_RELEASE_YEAR);
//Nomenclators
ListLoader.getInstance().load_nom_resultsPerPage();
// PROJECT
ListLoader.getInstance().load_nom_projectStatus();
// PROJECT TEAM
ListLoader.getInstance().load_nom_projectTeamStatus();
// TEAM MEMBER
ListLoader.getInstance().load_nom_teamMemberStatus();
// CLIENT
ListLoader.getInstance().load_nom_clientType();
ListLoader.getInstance().load_nom_clientStatus();
RoleVoter rv = (RoleVoter) CMContext.getApplicationContext().getBean("roleVoter");
// put exceptionContant bean on servletContect
sc.setAttribute(IConstant.EXCEPTION_CONSTANT, ExceptionConstant.getInstance());
sc.setAttribute(IConstant.PERMISSION_CONSTANT, PermissionConstant.getInstance());
sc.setAttribute(IConstant.BACK_CONSTANT, BackConstant.getInstance());
// initialize scheduler
initScheduler(true);
// job for deleting project details
deleteProjectDetailJob();
// job for finishing project details
finishProjectDetailJob();
// job for aborting project details
abortProjectDetailJob();
// open for opening project details
openProjectDetailJob();
// job for deleting team member details
deleteTeamMemberDetailJob();
logger.info("Role Prefix: \"" + rv.getRolePrefix() + "\"");
logger.info("*******************************************************");
logger.info("* *");
logger.info("* INITIATING APPLICATION END CLIENT MANAGEMENT<- *");
logger.info("* *");
logger.info("*******************************************************");
} catch (Exception ex) {
logger.info("*******************************************************");
logger.info("* *");
logger.info("* ERROR INITIATING APPLICATION!!! *");
logger.info("* *");
logger.info("*******************************************************");
logger.error("", ex);
}
logger.info("The application was initiated!");
}
示例13: init
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
/**
* Initializarea contextului. Aici se preiau nomenclatoarele ce se vor
* pastra pe sesiune
*/
public void init(ServletConfig conf) throws ServletException {
logger.info("Initializare aplicatie...");
try {
ServletContext sc = conf.getServletContext();
logger.info("*******************************************************");
logger.info("* *");
logger.info("* INITIATING APPLICATION TIME SHEET-> *");
logger.info("* *");
logger.info("*******************************************************");
logger.info(IConstant.APP_VERSION.concat("/").concat(IConstant.APP_RELEASE_DATE));
sc.setAttribute("VERSION", IConstant.APP_VERSION);
sc.setAttribute("RELEASE_DATE", IConstant.APP_RELEASE_DATE);
sc.setAttribute("RELEASE_YEAR", IConstant.APP_RELEASE_YEAR);
//Nomenclators
// RESULTS PER PAGE
ListLoader.getInstance().load_nom_resultsPerPage();
// PROJECT
ListLoader.getInstance().load_nom_projectStatus();
//BILLABLE
ListLoader.getInstance().load_nom_billable();
// TIME UNIT
ListLoader.getInstance().load_nom_timeUnit();
//SUPPORTED LANGUAGES
ListLoader.getInstance().load_nom_supportedLanguages();
//REPORT SUBTOTAL INTERVAL
ListLoader.getInstance().load_nom_reportSubtotalInterval();
//REPORT SUBTOTAL INTERVAL
ListLoader.getInstance().load_nom_pricesComputeType();
//REPORT PARAMS MAP
TSContext.storeOnContext(IConstant.REPORT_PARAM_MAP, new HashMap<String,ReportParams>());
RoleVoter rv = (RoleVoter) TSContext.getApplicationContext().getBean("roleVoter");
// put exceptionContant bean on servletContect
sc.setAttribute(IConstant.EXCEPTION_CONSTANT, ExceptionConstant.getInstance());
sc.setAttribute(IConstant.PERMISSION_CONSTANT, PermissionConstant.getInstance());
sc.setAttribute(IConstant.BACK_CONSTANT, BackConstant.getInstance());
logger.info("Role Prefix: \"" + rv.getRolePrefix() + "\"");
logger.info("*******************************************************");
logger.info("* *");
logger.info("* INITIATING APPLICATION END TIME SHEET<- *");
logger.info("* *");
logger.info("*******************************************************");
} catch (Exception ex) {
logger.info("*******************************************************");
logger.info("* *");
logger.info("* ERROR INITIATING APPLICATION!!! *");
logger.info("* *");
logger.info("*******************************************************");
logger.error("", ex);
}
logger.info("The application was initiated!");
}
示例14: init
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
/**
* Initializarea contextului. Aici se preiau nomenclatoarele ce se vor
* pastra in OMContext
*/
public void init(ServletConfig conf) throws ServletException {
logger.info("Initializare aplicatie...");
try {
ServletContext sc = conf.getServletContext();
logger.info("*******************************************************");
logger.info("* *");
logger.info("* ORGANISATION MANAGEMENT INITIALISATION: BEGIN *");
logger.info("* *");
logger.info("*******************************************************");
logger.info(IConstant.APP_VERSION.concat("/").concat(IConstant.APP_RELEASE_DATE));
sc.setAttribute("VERSION", IConstant.APP_VERSION);
sc.setAttribute("RELEASE_DATE", IConstant.APP_RELEASE_DATE);
sc.setAttribute("RELEASE_YEAR", IConstant.APP_RELEASE_YEAR);
//CLASSIFIED LISTS
ListLoader.getInstance().load_nom_module();
ListLoader.getInstance().load_nom_resultsPerPage();
ListLoader.getInstance().load_nom_organisationType();
ListLoader.getInstance().load_nom_group_companies_Type();
RoleVoter rv = (RoleVoter) OMContext.getApplicationContext().getBean("roleVoter");
// put permissionConstant bean on servletContext
sc.setAttribute(IConstant.PERMISSION_CONSTANT, PermissionConstant.getInstance());
// put exceptionContant bean on servletContect
sc.setAttribute(IConstant.EXCEPTION_CONSTANT, ExceptionConstant.getInstance());
// put backConstant on bean on servletContext
sc.setAttribute(IConstant.BACK_CONSTANT, BackConstant.getInstance());
// Set on App Context all Organizations' trees
OMContext.storeOnContext(IConstant.ORGANISATION_TREES, BLOrganisationStructure.getInstance().getAllOrganisationTrees());
//Set on App Context a map specifying which organisation has the audit module
OMContext.storeOnContext(IConstant.HAS_AUDIT_CONTEXT_MAP, composeHasAuditContextMap());
// Set up the security context for cross modules authentication and authorization
OMContext.storeOnContext(IConstant.SECURITY_TOKEN_REPOSITORY, new ConcurrentHashMap<String, Token>());
SecurityTokenMonitor.getInstance().start();
logger.debug("Cross modules security context initialized!");
// initialize scheduler
initScheduler(true);
if (isTrialVersion){
// manage the trial version timing
manageTrial();
}
// manage the ooo profiles
manageOOO();
logger.info("Role Prefix: \"" + rv.getRolePrefix() + "\"");
logger.info("*******************************************************");
logger.info("* *");
logger.info("* ORGANISATION MANAGEMENT INITIALISATION: END *");
logger.info("* *");
logger.info("*******************************************************");
} catch (Exception ex) {
logger.info("*******************************************************");
logger.info("* EROARE LA INTIALIZAREA APLICATIEI !!! *");
logger.info("*******************************************************");
logger.error("", ex);
}
logger.info("Aplicatia a fost initializata...");
}
示例15: init
import org.springframework.security.access.vote.RoleVoter; //导入依赖的package包/类
/**
* Initializarea contextului. Aici se preiau nomenclatoarele ce se vor
* pastra pe sesiune
*/
public void init(ServletConfig conf) throws ServletException {
logger.info("Initializare aplicatie...");
try {
ServletContext sc = conf.getServletContext();
logger.info("*******************************************************");
logger.info("* *");
logger.info("* INITIATING APPLICATION AUDIT-> *");
logger.info("* *");
logger.info("*******************************************************");
logger.info(IConstant.APP_VERSION.concat("/").concat(IConstant.APP_RELEASE_DATE));
sc.setAttribute("VERSION", IConstant.APP_VERSION);
sc.setAttribute("RELEASE_DATE", IConstant.APP_RELEASE_DATE);
sc.setAttribute("RELEASE_YEAR", IConstant.APP_RELEASE_YEAR);
//Nomenclators
ListLoader.getInstance().load_nom_resultsPerPage();
ListLoader.getInstance().load_nom_module();
ListLoader.getInstance().load_nom_om_audit_events();
ListLoader.getInstance().load_nom_dm_audit_events();
ListLoader.getInstance().load_nom_cm_audit_events();
ListLoader.getInstance().load_nom_ts_audit_events();
RoleVoter rv = (RoleVoter) AuditContext.getApplicationContext().getBean("roleVoter");
// put exceptionContant bean on servletContect
sc.setAttribute(IConstant.EXCEPTION_CONSTANT, ExceptionConstant.getInstance());
sc.setAttribute(IConstant.PERMISSION_CONSTANT, PermissionConstant.getInstance());
sc.setAttribute(IConstant.AUDIT_REPORT_SERVLET, ConfigParametersProvider.getConfigString("audit.report.servlet.url"));
logger.info("Role Prefix: \"" + rv.getRolePrefix() + "\"");
logger.info("*******************************************************");
logger.info("* *");
logger.info("* INITIATING APPLICATION END AUDIT<- *");
logger.info("* *");
logger.info("*******************************************************");
} catch (Exception ex) {
logger.info("*******************************************************");
logger.info("* *");
logger.info("* ERROR INITIATING APPLICATION!!! *");
logger.info("* *");
logger.info("*******************************************************");
logger.error("", ex);
}
logger.info("The application was initiated!");
}