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

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

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

origin: apache/jackrabbit-oak

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

@Test
public void testConfigOptions2() {
  long exp = getConfig(TokenConfiguration.class).getParameters().getConfigValue(TokenProvider.PARAM_TOKEN_EXPIRATION, TokenProviderImpl.DEFAULT_TOKEN_EXPIRATION);
  assertEquals(60, exp);
}
origin: apache/jackrabbit-oak

@Test
public void testEmptyConstructor() {
  TokenConfiguration composite = new CompositeTokenConfiguration();
  assertEquals(TokenConfiguration.NAME, composite.getName());
}
origin: apache/jackrabbit-oak

@Test
public void testSetTokenConfiguration() {
  TokenConfiguration tc = Mockito.mock(TokenConfiguration.class);
  when(tc.getParameters()).thenReturn(PARAMS);
  securityProvider.setTokenConfiguration(tc);
  assertSame(tc, securityProvider.getConfiguration(TokenConfiguration.class));
  for (SecurityConfiguration sc : securityProvider.getConfigurations()) {
    if (sc instanceof TokenConfiguration) {
      assertSame(tc, sc);
    }
  }
  assertEquals(PARAMS, securityProvider.getParameters(TokenConfiguration.NAME));
}
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

@Test
public void testRefresh() {
  boolean refresh = getConfig(TokenConfiguration.class).getParameters().getConfigValue(TokenProvider.PARAM_TOKEN_REFRESH, false);
  assertTrue(refresh);
}
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.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: 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: 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.tokenTokenConfiguration

Javadoc

Configuration for token management.

Most used methods

  • getTokenProvider
    Returns a new instance of org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider.
  • getName
  • getParameters

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Socket (java.net)
    Provides a client-side TCP socket.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Reference (javax.naming)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Top Vim 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