Tabnine Logo
TokenConfiguration.getTokenProvider
Code IndexAdd Tabnine to your IDE (free)

How to use
getTokenProvider
method
in
org.apache.jackrabbit.oak.spi.security.authentication.token.TokenConfiguration

Best Java code snippets using org.apache.jackrabbit.oak.spi.security.authentication.token.TokenConfiguration.getTokenProvider (Showing top 9 results out of 315)

origin: apache/jackrabbit-oak

  @Override
  public TokenProvider apply(TokenConfiguration tokenConfiguration) {
    return tokenConfiguration.getTokenProvider(root);
  }
});
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

  @Override
  public TokenProvider apply(TokenConfiguration tokenConfiguration) {
    return tokenConfiguration.getTokenProvider(root);
  }
});
origin: apache/jackrabbit-oak

/**
 * Retrieve the token provider
 * @return the token provider or {@code null}.
 */
@Nullable
private TokenProvider getTokenProvider() {
  TokenProvider provider = null;
  SecurityProvider securityProvider = getSecurityProvider();
  Root root = getRoot();
  if (root != null && securityProvider != null) {
    TokenConfiguration tokenConfig = securityProvider.getConfiguration(TokenConfiguration.class);
    provider = tokenConfig.getTokenProvider(root);
  }
  if (provider == null && callbackHandler != null) {
    try {
      TokenProviderCallback tcCallback = new TokenProviderCallback();
      callbackHandler.handle(new Callback[] {tcCallback});
      provider = tcCallback.getTokenProvider();
    } catch (IOException | UnsupportedCallbackException e) {
      log.warn(e.getMessage());
    }
  }
  return provider;
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * Retrieve the token provider
 * @return the token provider or {@code null}.
 */
@CheckForNull
private TokenProvider getTokenProvider() {
  TokenProvider provider = null;
  SecurityProvider securityProvider = getSecurityProvider();
  Root root = getRoot();
  if (root != null && securityProvider != null) {
    TokenConfiguration tokenConfig = securityProvider.getConfiguration(TokenConfiguration.class);
    provider = tokenConfig.getTokenProvider(root);
  }
  if (provider == null && callbackHandler != null) {
    try {
      TokenProviderCallback tcCallback = new TokenProviderCallback();
      callbackHandler.handle(new Callback[] {tcCallback});
      provider = tcCallback.getTokenProvider();
    } catch (IOException e) {
      log.warn(e.getMessage());
    } catch (UnsupportedCallbackException e) {
      log.warn(e.getMessage());
    }
  }
  return provider;
}
origin: org.apache.jackrabbit/oak-core

/**
 * Retrieve the token provider
 * @return the token provider or {@code null}.
 */
@Nullable
private TokenProvider getTokenProvider() {
  TokenProvider provider = null;
  SecurityProvider securityProvider = getSecurityProvider();
  Root root = getRoot();
  if (root != null && securityProvider != null) {
    TokenConfiguration tokenConfig = securityProvider.getConfiguration(TokenConfiguration.class);
    provider = tokenConfig.getTokenProvider(root);
  }
  if (provider == null && callbackHandler != null) {
    try {
      TokenProviderCallback tcCallback = new TokenProviderCallback();
      callbackHandler.handle(new Callback[] {tcCallback});
      provider = tcCallback.getTokenProvider();
    } catch (IOException | UnsupportedCallbackException e) {
      log.warn(e.getMessage());
    }
  }
  return provider;
}
origin: apache/jackrabbit-oak

ContentSession session = login(getAdminCredentials());
Root r = session.getLatestRoot();
tokenProviders.add(tc.getTokenProvider(r));
sessions.add(session);
origin: apache/jackrabbit-oak

@Test
public void testValidTokenCredentials() throws Exception {
  Root root = adminSession.getLatestRoot();
  TokenConfiguration tokenConfig = getSecurityProvider().getConfiguration(TokenConfiguration.class);
  TokenProvider tp = tokenConfig.getTokenProvider(root);
  SimpleCredentials sc = (SimpleCredentials) getAdminCredentials();
  TokenInfo info = tp.createToken(sc.getUserID(), Collections.<String, Object>emptyMap());
  ContentSession cs = login(new TokenCredentials(info.getToken()));
  try {
    assertEquals(sc.getUserID(), cs.getAuthInfo().getUserID());
  } finally {
    cs.close();
  }
}
origin: apache/jackrabbit-oak

@Test
public void testValidTokenCredentials() throws Exception {
  Root root = adminSession.getLatestRoot();
  TokenConfiguration tc = getSecurityProvider().getConfiguration(TokenConfiguration.class);
  TokenProvider tp = tc.getTokenProvider(root);
  SimpleCredentials sc = (SimpleCredentials) getAdminCredentials();
  TokenInfo info = tp.createToken(sc.getUserID(), Collections.<String, Object>emptyMap());
  ContentSession cs = login(new TokenCredentials(info.getToken()));
  try {
    assertEquals(sc.getUserID(), cs.getAuthInfo().getUserID());
  } finally {
    cs.close();
  }
}
origin: apache/jackrabbit-oak

/**
 * @see <a href="https://issues.apache.org/jira/browse/OAK-1985">OAK-1985</a>
 */
@Test
public void testTokenValidationIsCaseInsensitive() throws Exception {
  Root root = adminSession.getLatestRoot();
  TokenConfiguration tokenConfig = getSecurityProvider().getConfiguration(TokenConfiguration.class);
  TokenProvider tp = tokenConfig.getTokenProvider(root);
  String userId = ((SimpleCredentials) getAdminCredentials()).getUserID();
  TokenInfo info = tp.createToken(userId.toUpperCase(), Collections.<String, Object>emptyMap());
  assertTrue(info.matches(new TokenCredentials(info.getToken())));
  assertEquals(userId, info.getUserId());
  info = tp.getTokenInfo(info.getToken());
  assertTrue(info.matches(new TokenCredentials(info.getToken())));
  assertEquals(userId, info.getUserId());
}
org.apache.jackrabbit.oak.spi.security.authentication.tokenTokenConfigurationgetTokenProvider

Javadoc

Returns a new instance of org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider.

Popular methods of TokenConfiguration

  • getName
  • getParameters

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • getResourceAsStream (ClassLoader)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JButton (javax.swing)
  • JTable (javax.swing)
  • Github Copilot alternatives
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