congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SimpleKeycloakAccount
Code IndexAdd Tabnine to your IDE (free)

How to use
SimpleKeycloakAccount
in
org.keycloak.adapters.springsecurity.account

Best Java code snippets using org.keycloak.adapters.springsecurity.account.SimpleKeycloakAccount (Showing top 3 results out of 315)

origin: org.keycloak/keycloak-spring-security-adapter

@Override
protected void completeBearerAuthentication(KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method) {
  RefreshableKeycloakSecurityContext securityContext = principal.getKeycloakSecurityContext();
  Set<String> roles = AdapterUtils.getRolesFromSecurityContext(securityContext);
  final KeycloakAccount account = new SimpleKeycloakAccount(principal, roles, securityContext);
  logger.debug("Completing bearer authentication. Bearer roles: {} ",roles);
  SecurityContextHolder.getContext().setAuthentication(new KeycloakAuthenticationToken(account, false));
  request.setAttribute(KeycloakSecurityContext.class.getName(), securityContext);
}
origin: org.geoserver.community/gs-sec-keycloak

/**
 * Create a successful result.
 *
 * @param authentication valid credentials
 */
public AuthResults(Authentication authentication) {
  Object username = null;
  Object details = null;
  if (authentication.getDetails() instanceof SimpleKeycloakAccount) {
    details = (SimpleKeycloakAccount) authentication.getDetails();
    assert ((SimpleKeycloakAccount) details).getPrincipal() instanceof KeycloakPrincipal;
    final KeycloakPrincipal principal =
        (KeycloakPrincipal) ((SimpleKeycloakAccount) details).getPrincipal();
    username = principal.getName();
    if (principal.getKeycloakSecurityContext().getIdToken() != null) {
      username =
          principal.getKeycloakSecurityContext().getIdToken().getPreferredUsername();
    }
  } else {
    username = authentication.getPrincipal();
    details = authentication.getDetails();
  }
  this.authentication =
      new UsernamePasswordAuthenticationToken(
          username, authentication.getCredentials(), authentication.getAuthorities());
  ((UsernamePasswordAuthenticationToken) this.authentication).setDetails(details);
  this.challenge = null;
}
origin: org.keycloak/keycloak-spring-security-adapter

@Override
protected void completeOAuthAuthentication(final KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal) {
  final RefreshableKeycloakSecurityContext securityContext = principal.getKeycloakSecurityContext();
  final Set<String> roles = AdapterUtils.getRolesFromSecurityContext(securityContext);
  final OidcKeycloakAccount account = new SimpleKeycloakAccount(principal, roles, securityContext);
  request.setAttribute(KeycloakSecurityContext.class.getName(), securityContext);
  this.tokenStore.saveAccountInfo(account);
}
org.keycloak.adapters.springsecurity.accountSimpleKeycloakAccount

Javadoc

Concrete, serializable org.keycloak.adapters.OidcKeycloakAccount implementation.

Most used methods

  • <init>
  • getPrincipal

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now