private Set<Principal> getPrincipalRoles(Account account) { final Set<Principal> roles = new HashSet<>(); for (String role : account.getRoles()) { roles.add(new SimplePrincipal(role)); } return roles; }
@Override public boolean isUserInRole(String role) { SecurityContext sc = exchange.getSecurityContext(); if(sc == null) { return false; } Account authenticatedAccount = sc.getAuthenticatedAccount(); if(authenticatedAccount == null) { return false; } return authenticatedAccount.getRoles().contains(role); }
private Principal[] getGrantedRoles(Account account, Deployment deployment) { if (account == null) { return new Principal[] {}; } Set<String> roles = new HashSet<>(account.getRoles()); Map<String, Set<String>> principalVersusRolesMap = deployment.getDeploymentInfo().getPrincipalVersusRolesMap(); roles.addAll(principalVersusRolesMap.getOrDefault(account.getPrincipal().getName(), Collections.emptySet())); Principal[] principals = new Principal[roles.size()]; int index = 0; for (String role : roles) { principals[index++] = () -> role; } return principals; } }
@Override public SingleSignOn createSingleSignOn(Account account, String mechanism) { String id = SECURE_RANDOM_SESSION_ID_GENERATOR.createSessionId(); SingleSignOn entry = new SimpleSingleSignOnEntry(id, account, mechanism); this.ssoEntries.put(id, entry); if(log.isTraceEnabled()) { log.tracef("Creating SSO ID %s for Principal %s and Roles %s.", id, account.getPrincipal().getName(), account.getRoles().toString()); } return entry; }
protected void authenticationComplete(Account account, String mechanism, boolean programatic, final boolean cachingRequired) { this.account = account; this.mechanismName = mechanism; UndertowLogger.SECURITY_LOGGER.debugf("Authenticated as %s, roles %s", account.getPrincipal().getName(), account.getRoles()); sendNoticiation(new SecurityNotification(exchange, EventType.AUTHENTICATED, account, mechanism, programatic, MESSAGES.userAuthenticated(account.getPrincipal().getName()), cachingRequired)); }
roles.addAll(account.getRoles());
roles.addAll(account.getRoles());
PolicyContext.getContextID(), callerSubject, new ArrayList<String>(account.getRoles()));
for (String role : cachedAccount.getRoles()) roleGroup.addRole(new SimpleRole(role)); jbossSct.getUtil().setRoles(roleGroup);
@Override public Set<String> getRoles() { return delegate.getRoles(); }
private Set<Principal> getPrincipalRoles(Account account) { final Set<Principal> roles = new HashSet<>(); for (String role : account.getRoles()) { roles.add(new SimplePrincipal(role)); } return roles; }
boolean matchesExpectedRoles() { int matchedRoles = 0; for ( String expectedRole : expectedRoles ) for ( String role : context.getAuthenticatedAccount().getRoles() ) if ( expectedRole.equals( role ) ) matchedRoles++; return matchedRoles == expectedRoles.size(); }
private Stream<String> roles(HttpServerExchange exchange) { return account(exchange).getRoles().stream(); }
private Set<Principal> getPrincipalRoles(Account account) { final Set<Principal> roles = new HashSet<>(); for (String role : account.getRoles()) { roles.add(new SimplePrincipal(role)); } return roles; }
@Override public boolean isUserInRole(String role) { SecurityContext sc = exchange.getSecurityContext(); if(sc == null) { return false; } Account authenticatedAccount = sc.getAuthenticatedAccount(); if(authenticatedAccount == null) { return false; } return authenticatedAccount.getRoles().contains(role); }
@Override public boolean isUserInRole(String role) { SecurityContext sc = exchange.getSecurityContext(); if(sc == null) { return false; } Account authenticatedAccount = sc.getAuthenticatedAccount(); if(authenticatedAccount == null) { return false; } return authenticatedAccount.getRoles().contains(role); }
@Override public SingleSignOn createSingleSignOn(Account account, String mechanism) { String id = SECURE_RANDOM_SESSION_ID_GENERATOR.createSessionId(); SingleSignOn entry = new SimpleSingleSignOnEntry(id, account, mechanism); this.ssoEntries.put(id, entry); if(log.isTraceEnabled()) { log.tracef("Creating SSO ID %s for Principal %s and Roles %s.", id, account.getPrincipal().getName(), account.getRoles().toString()); } return entry; }
@Override public SingleSignOn createSingleSignOn(Account account, String mechanism) { String id = SECURE_RANDOM_SESSION_ID_GENERATOR.createSessionId(); SingleSignOn entry = new SimpleSingleSignOnEntry(id, account, mechanism); this.ssoEntries.put(id, entry); if(log.isTraceEnabled()) { log.tracef("Creating SSO ID %s for Principal %s and Roles %s.", id, account.getPrincipal().getName(), account.getRoles().toString()); } return entry; }
protected void authenticationComplete(Account account, String mechanism, boolean programatic, final boolean cachingRequired) { this.account = account; this.mechanismName = mechanism; UndertowLogger.SECURITY_LOGGER.debugf("Authenticated as %s, roles %s", account.getPrincipal().getName(), account.getRoles()); sendNoticiation(new SecurityNotification(exchange, EventType.AUTHENTICATED, account, mechanism, programatic, MESSAGES.userAuthenticated(account.getPrincipal().getName()), cachingRequired)); }
protected void authenticationComplete(Account account, String mechanism, boolean programatic, final boolean cachingRequired) { this.account = account; this.mechanismName = mechanism; UndertowLogger.SECURITY_LOGGER.debugf("Authenticated as %s, roles %s", account.getPrincipal().getName(), account.getRoles()); sendNoticiation(new SecurityNotification(exchange, EventType.AUTHENTICATED, account, mechanism, programatic, MESSAGES.userAuthenticated(account.getPrincipal().getName()), cachingRequired)); }