Codota Logo
Credentials.<init>
Code IndexAdd Codota to your IDE (free)

How to use
de.otto.edison.authentication.Credentials
constructor

Best Java code snippets using de.otto.edison.authentication.Credentials.<init> (Showing top 2 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: otto-de/edison-microservice

  /**
   * Read username and password from the request's {@code Authorization} header and create a {@code Credentials}
   * object. Requires authorization header to be base64 encoded.
   *
   * @param request incoming http request
   * @return {@code Optional} with parsed {@code Credentials} if {@code Authorization} header and credentials
   * are present, {@code Optional.empty} otherwise.
   */
  public static Optional<Credentials> readFrom(HttpServletRequest request) {
    String authorizationHeader = request.getHeader("Authorization");
    if (!StringUtils.isEmpty(authorizationHeader)) {
      String credentials = authorizationHeader.substring(6, authorizationHeader.length());
      String[] decodedCredentialParts = new String(Base64Utils.decode(credentials.getBytes())).split(":", 2);
      if (!decodedCredentialParts[0].isEmpty() && !decodedCredentialParts[1].isEmpty()) {
        return Optional.of(new Credentials(decodedCredentialParts[0], decodedCredentialParts[1]));
      }
    }
    return Optional.empty();
  }
}
origin: otto-de/edison-microservice

@Test
public void shouldBuildUserDnFromCredentials() {
  final String userDn = testee.userDnFrom(new Credentials("user", "password"), "someBaseDn");
  assertThat(userDn).isEqualTo("someRdnIdentifier=user,someBaseDn");
}
de.otto.edison.authenticationCredentials<init>

Popular methods of Credentials

  • getUsername
  • readFrom
    Read username and password from the request's Authorization header and create a Credentialsobject. R
  • getPassword

Popular in Java

  • Making http requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now