本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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