Tabnine Logo
Credentials.<init>
Code IndexAdd Tabnine 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)

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

  • Parsing JSON documents to java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getApplicationContext (Context)
  • startActivity (Activity)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • From CI to AI: The AI layer in your organization
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