package org.aktin.broker.auth.cred;

import java.io.IOException;
import java.util.function.BiConsumer;

import org.aktin.broker.server.auth.AbstractAuthProvider;

public class CredentialTokenAuthProvider extends AbstractAuthProvider{
	private TokenManager manager;
	private CredentialTokenAuth auth;

	public CredentialTokenAuthProvider(String simplePassword) {
		this.manager = new TokenManager(simplePassword);
		this.auth = new CredentialTokenAuth(manager);
	}
	@Override
	public CredentialTokenAuth getInstance() throws IOException {
		return auth;
	}

	@Override
	public void bindSingletons(BiConsumer<Object, Class<?>> binder) {
		binder.accept(manager, TokenManager.class);
	}

	@Override
	public Class<?>[] getEndpoints() {
		return new Class<?>[] { AuthEndpoint.class };
	}

	public TokenManager getManager() {
		return manager;
	}
}

@@ -294,16 +294,118 @@
  auth;%0A%0A
+%09/**%0A%09 * Specific constructor to use a single simple password%0A%09 * @param simplePassword password%0A%09 */%0A
 %09public 
@@ -558,16 +558,201 @@
 ger);%0A%09%7D
+%0A%0A%09/**%0A%09 * Default constructor using random password%0A%09 */%0A%09public CredentialTokenAuthProvider() %7B%0A%09%09this.manager = new TokenManager();%0A%09%09this.auth = new CredentialTokenAuth(manager);%0A%09%7D
 %0A%09@Overr

add default consructor to use random password