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


Java Roles类代码示例

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


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

示例1: isInstantiationAuthorized

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
    if (componentClass == CmsPage.class) {
        RequestCycle requestCycle = RequestCycle.get();
        String pageId = requestCycle.getRequest().getQueryParameters().getParameterValue("pageId").toString("");
        PageRoleTable pageRoleTable = Tables.PAGE_ROLE.as("pageRoleTable");
        RoleTable roleTable = Tables.ROLE.as("roleTable");
        DSLContext context = Spring.getBean(DSLContext.class);
        List<String> roles = context.select(roleTable.NAME).from(roleTable).innerJoin(pageRoleTable).on(roleTable.ROLE_ID.eq(pageRoleTable.ROLE_ID)).where(pageRoleTable.PAGE_ID.eq(pageId)).fetchInto(String.class);
        Roles r = new Roles();
        if (roles != null && !roles.isEmpty()) {
            r.addAll(roles);
        }
        return hasAny(r);
    } else {
        return super.isInstantiationAuthorized(componentClass);
    }
}
 
开发者ID:PkayJava,项目名称:MBaaS,代码行数:19,代码来源:AnnotationsRoleAuthorizationStrategy.java

示例2: 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

示例3: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入依赖的package包/类
@Override
public Roles getRoles() {
    Roles roles = new Roles();
    //todo - used for wicket auth roles...
    MidPointPrincipal principal = SecurityUtils.getPrincipalUser();
    if (principal == null) {
        return roles;
    }
    for (Authorization authz : principal.getAuthorities()) {
        roles.addAll(authz.getAction());
    }

    return roles;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:15,代码来源:MidPointAuthWebSession.java

示例4: 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

示例5: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入依赖的package包/类
@Override
public Roles getRoles() {
    if (getUserDetails() != null) {
        return new Roles(getUserDetails().getPermissions().stream().map(sp -> sp.getSingularId()).collect(Collectors.toList()).toArray(new String[0]));
    }
    return new Roles();
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:8,代码来源:SingularSession.java

示例6: authenticate

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入依赖的package包/类
@Override
protected boolean authenticate(String username, String password) {
    try {
        User user = new User(username, Roles.USER);
        this.xmppService = new XmppService(user.getUri(), password);
        this.intercloudService = new IntercloudService(this.xmppService);
        this.user = user;
        return true;
    } catch (Exception e) {
        logger.error("Cannot connect to xmpp server. jid: {}", username, e);
        return false;
    }
}
 
开发者ID:citlab,项目名称:Intercloud,代码行数:14,代码来源:IntercloudWebSession.java

示例7: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入依赖的package包/类
@Override
public Roles getRoles() {
    if (isSignedIn() && user != null) {
        return user.getRoles();
    }
    return null;
}
 
开发者ID:citlab,项目名称:Intercloud,代码行数:8,代码来源:IntercloudWebSession.java

示例8: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入依赖的package包/类
/**
 * Returns the current user roles.
 * 
 * @return current user roles
 */
@Override
public Roles getRoles() {
	if (!rolesInitialized) {
		Collection<? extends GrantedAuthority> authorities = authenticationService.getAuthorities();
		for (GrantedAuthority authority : authorities) {
			roles.add(authority.getAuthority());
		}
		rolesInitialized = true;
	}
	return roles;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:17,代码来源:AbstractCoreSession.java

示例9: signOutWithoutCleaningUpRedirectUrl

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入依赖的package包/类
/**
 * @deprecated Only useful when using OWSI-Core's redirection mechanism, which is deprecated.
 * 
 * @see {@link #registerRedirectUrl(String)} for information about alternative mechanisms.
 */
@Deprecated
public void signOutWithoutCleaningUpRedirectUrl() {
	userModel.setObject(null);
	roles = new Roles();
	rolesInitialized = false;
	permissions = Lists.newArrayList();
	permissionsInitialized = false;
	
	authenticationService.signOut();
	
	super.signOut();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:18,代码来源:AbstractCoreSession.java

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: getRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入依赖的package包/类
@Override
public Roles getRoles() {
    if (useAuthentication) {
        return super.getRoles();
    } else {
    	if (getPaasUser() != null) {
     		return new Roles(getPaasUser().getPaasUserRole().name());

    	}
    	else {
    		return new Roles("ROLE_USER");
    	}
    }
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:15,代码来源:PaasTestSession.java

示例15: setWicketRoles

import org.apache.wicket.authroles.authorization.strategies.role.Roles; //导入依赖的package包/类
private void setWicketRoles(Authentication authentication) {
    Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
    String[] authorityRoles = new String[authorities.size()];
    int i = 0;
    for (GrantedAuthority authority : authorities) {
        String role = authority.getAuthority();
        authorityRoles[i] = role;
        i++;
    }
    roles = new Roles(authorityRoles);
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:12,代码来源:ArtifactoryWebSession.java


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