@Test public void understandsShaHashValues() throws Exception { MatcherAssert.assertThat( new Htpasswd( this.host("john:{SHA}6qagQQ8seo0bw69C/mNKhYbSf34=") ).authorized("john", "victory"), Matchers.is(true) ); MatcherAssert.assertThat( new Htpasswd( this.host("susi:{SHA}05jkyU4N/+ADjjOghbccdO5zKHE=") ).authorized("susi", "a7a6s-"), Matchers.is(true) ); MatcherAssert.assertThat( new Htpasswd( this.host("william:{SHA}qUqP5cyxm6YcTAhz05Hph5gvu9M=") ).authorized("william", "invalid-pwd"), Matchers.is(false) ); }
@LogExceptions public boolean authorized(@NotNull final String user, @NotNull final String password) throws IOException { final ConcurrentMap<String, String> users = this.fetch(); return users.containsKey(user) && Htpasswd.matches(users.get(user), password); }
Htpasswd { @LogExceptions public boolean authorized(@NotNull final String user, @NotNull final String password) throws IOException { final ConcurrentMap<String, String> users = this.fetch(); return users.containsKey(user) && Htpasswd.matches(users.get(user), password); } }
Htpasswd { @LogExceptions public boolean authorized(@NotNull final String user, @NotNull final String password) throws IOException { final ConcurrentMap<String, String> users = this.fetch(); return users.containsKey(user) && Htpasswd.matches(users.get(user), password); } Htpasswd(@NotNull final Host hst); }
Htpasswd { @LogExceptions public boolean authorized(@NotNull final String user, @NotNull final String password) throws IOException { final ConcurrentMap<String, String> users = this.fetch(); return users.containsKey(user) && Htpasswd.matches(users.get(user), password); } Htpasswd(@NotNull final Host hst); @Override String toString(); @LogExceptions boolean authorized(@NotNull final String user,
        @NotNull final String password); }
Htpasswd { @LogExceptions public boolean authorized(@NotNull final String user, @NotNull final String password) throws IOException { final ConcurrentMap<String, String> users = this.fetch(); return users.containsKey(user) && Htpasswd.matches(users.get(user), password); } Htpasswd(@NotNull final Host hst); @Override String toString(); @LogExceptions boolean authorized(@NotNull final String user,
        @NotNull final String password);  }