Use the AuthProviderInternal interface to avoid a strong dependency on oauth2 auth provider
@@ -20,8 +20,7 @@ import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.json.JsonObject;
-import io.vertx.ext.auth.oauth2.OAuth2Auth;
-import io.vertx.ext.auth.oauth2.OAuth2FlowType;
+import io.vertx.ext.auth.impl.AuthProviderInternal;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.auth.AuthProvider;
@@ -36,17 +35,11 @@ public class BasicAuthHandlerImpl extends AuthorizationAuthHandler {
/**
* This is a verification step, it can abort the instantiation by
* throwing a RuntimeException
- *
- * @param provider
- * @return
*/
private static AuthProvider verifyProvider(AuthProvider provider) {
- if (provider instanceof OAuth2Auth) {
- if (((OAuth2Auth) provider).getFlowType() != OAuth2FlowType.PASSWORD) {
- throw new IllegalArgumentException("OAuth2Auth + Basic Auth requires OAuth2 PASSWORD flow");
- }
+ if (provider instanceof AuthProviderInternal) {
+ ((AuthProviderInternal)provider).verifyIsUsingPassword();
}
-
return provider;
}
