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


Java Roles.add方法代码示例

本文整理汇总了Java中org.apache.wicket.authroles.authorization.strategies.role.Roles.add方法的典型用法代码示例。如果您正苦于以下问题:Java Roles.add方法的具体用法?Java Roles.add怎么用?Java Roles.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.wicket.authroles.authorization.strategies.role.Roles的用法示例。


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

示例1: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入方法依赖的package包/类
@Override
public Roles getRoles() {
	Roles ret = new Roles();
	if(isSignedIn())
	{
		Set<? extends OSecurityRole> roles = getUser().getRoles();
		for (OSecurityRole oRole : roles) {
			ret.add(oRole.getName());
			OSecurityRole parent = oRole.getParentRole();
			while(parent!=null && !ret.contains(parent.getName()))
			{
				ret.add(parent.getName());
				parent = parent.getParentRole();
			}
		}
	}
	return ret;
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:19,代码来源:OrientDbWebSession.java

示例2: isAuthorized

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入方法依赖的package包/类
public static boolean isAuthorized(Collection<String> actions) {
	if (actions == null || actions.isEmpty()) {
		return true;
	}
	Roles roles = new Roles(AuthorizationConstants.AUTZ_ALL_URL);
	roles.add(AuthorizationConstants.AUTZ_GUI_ALL_URL);
	roles.add(AuthorizationConstants.AUTZ_GUI_ALL_DEPRECATED_URL);
	roles.addAll(actions);
	if (((AuthenticatedWebApplication) AuthenticatedWebApplication.get()).hasAnyRole(roles)) {
		return true;
	}
	return false;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:14,代码来源:WebComponentUtil.java

示例3: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入方法依赖的package包/类
@Override
public Roles getRoles() {
	if (rights.isEmpty()) {
		isSignedIn();
	}
	Roles r = new Roles();
	for (Right right : rights) {
		r.add(right.name());
	}
	return r;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:12,代码来源:WebSession.java

示例4: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入方法依赖的package包/类
@Override
public Roles getRoles()
{
    Roles roles = new Roles();
    if (isSignedIn()) {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        for (GrantedAuthority authority : authentication.getAuthorities()) {
            roles.add(authority.getAuthority());
        }
    }
    return roles;
}
 
开发者ID:webanno,项目名称:webanno,代码行数:13,代码来源:SpringAuthenticatedWebSession.java

示例5: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入方法依赖的package包/类
@Override
public Roles getRoles() {
	Roles roles = new Roles();
	if (isSignedIn()) {
		Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
		for (GrantedAuthority authority : authentication.getAuthorities()) {
			roles.add(authority.getAuthority());
		}
	}
	return roles;
}
 
开发者ID:MarcGiffing,项目名称:wicket-spring-boot,代码行数:12,代码来源:SecureWebSession.java

示例6: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入方法依赖的package包/类
@Override
public Roles getRoles() {
	Roles roles = new Roles();
	Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
	if (authentication !=null) {
		for (GrantedAuthority authority : authentication.getAuthorities()) {
			roles.add(authority.getAuthority());
		}
	}  else {
		logger.warn("Authentication from SecurityContextHolder is null. No role affected.");
	}
	return roles;
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:14,代码来源:WicketSession.java

示例7: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入方法依赖的package包/类
@Override
public Roles getRoles() {
    Roles roles = new Roles();
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    for (GrantedAuthority authority : authentication.getAuthorities()) {
        roles.add(authority.getAuthority());
    }
    return roles;
}
 
开发者ID:holy-shit,项目名称:wicket-spring-security-example,代码行数:10,代码来源:UserAuthenticatedWebSession.java

示例8: doInitializeSession

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入方法依赖的package包/类
protected void doInitializeSession() {
	U user = userService.getByUserName(authenticationService.getUserName());
	
	if (user == null) {
		throw new IllegalStateException("Unable to find the signed in user.");
	}
	
	userModel.setObject(user);
	
	try {
		if (user.getLastLoginDate() == null) {
			onFirstLogin(user);
		}
		
		userService.updateLastLoginDate(user);
		
		Locale locale = user.getLocale();
		if (locale != null) {
			setLocale(user.getLocale());
		} else {
			// si la personne ne possède pas de locale
			// alors on enregistre celle mise en place
			// automatiquement par le navigateur.
			userService.updateLocale(user, getLocale());
		}
	} catch (RuntimeException | ServiceException | SecurityServiceException e) {
		LOGGER.error(String.format("Unable to update the user information on sign in: %1$s", user), e);
	}
	
	Collection<? extends GrantedAuthority> authorities = authenticationService.getAuthorities();
	roles = new Roles();
	for (GrantedAuthority authority : authorities) {
		roles.add(authority.getAuthority());
	}
	rolesInitialized = true;
	
	permissions = authenticationService.getPermissions();
	permissionsInitialized = true;
	
	isSuperUser = authenticationService.isSuperUser();
	isSuperUserInitialized = true;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:43,代码来源:AbstractCoreSession.java

示例9: addRolesFromAuthentication

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入方法依赖的package包/类
private void addRolesFromAuthentication(Roles roles, Authentication authentication) {
    for (GrantedAuthority authority : authentication.getAuthorities()) {
        roles.add(authority.getAuthority().replaceFirst("ROLE_",""));
    }
}
 
开发者ID:mpostelnicu,项目名称:wicket-spring-jpa-bootstrap-boilerplate,代码行数:6,代码来源:SSAuthenticatedWebSession.java


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