All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth Maven / Gradle / Ivy

/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.reactivex.ext.auth.otp.hotp;

import io.vertx.reactivex.RxHelper;
import io.vertx.reactivex.ObservableHelper;
import io.vertx.reactivex.FlowableHelper;
import io.vertx.reactivex.impl.AsyncResultMaybe;
import io.vertx.reactivex.impl.AsyncResultSingle;
import io.vertx.reactivex.impl.AsyncResultCompletable;
import io.vertx.reactivex.WriteStreamObserver;
import io.vertx.reactivex.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;

/**
 * An extension of AuthProvider which uses the one time passwords based on counter to perform authentication.
 *
 * 

* NOTE: This class has been automatically generated from the {@link io.vertx.ext.auth.otp.hotp.HotpAuth original} non RX-ified interface using Vert.x codegen. */ @RxGen(io.vertx.ext.auth.otp.hotp.HotpAuth.class) public class HotpAuth extends io.vertx.reactivex.ext.auth.authentication.AuthenticationProvider { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HotpAuth that = (HotpAuth) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new HotpAuth((io.vertx.ext.auth.otp.hotp.HotpAuth) obj), HotpAuth::getDelegate ); private final io.vertx.ext.auth.otp.hotp.HotpAuth delegate; public HotpAuth(io.vertx.ext.auth.otp.hotp.HotpAuth delegate) { super(delegate); this.delegate = delegate; } public HotpAuth(Object delegate) { super((io.vertx.ext.auth.otp.hotp.HotpAuth)delegate); this.delegate = (io.vertx.ext.auth.otp.hotp.HotpAuth)delegate; } public io.vertx.ext.auth.otp.hotp.HotpAuth getDelegate() { return delegate; } /** * Provide a that can fetch s from a backend given an identifier * argument. *

* The function signature is as follows: *

* (id) -> Future * *

    *
  • id the identifier to lookup.
  • *
  • async result with a authenticator.
  • *
* @param fetcher fetcher function. * @return fluent self. */ public io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth authenticatorFetcher(java.util.function.Function> fetcher) { delegate.authenticatorFetcher(new Function>() { public io.vertx.core.Future apply(java.lang.String arg) { io.vertx.core.Future ret = fetcher.apply(arg); return ret.map(val -> val); } }); return this; } /** * Provide a that can fetch s from a backend given an identifier * argument. *

* The function signature is as follows: *

* (id) -> Future * *

    *
  • id the identifier to lookup.
  • *
  • async result with a authenticator.
  • *
* @param fetcher fetcher function. * @return fluent self. */ public io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth authenticatorFetcher(io.reactivex.functions.Function> fetcher) { delegate.authenticatorFetcher(new Function>() { public io.vertx.core.Future apply(java.lang.String arg) { io.reactivex.Single ret; try { ret = fetcher.apply(arg); } catch (Exception e) { return io.vertx.core.Future.failedFuture(e); } return io.vertx.reactivex.SingleHelper.toFuture(ret, obj -> obj); } }); return this; } /** * Provide a that can update or insert a . * The function should store a given authenticator to a persistence storage. *

* When an authenticator is already present, this method must at least update * , and is not required to perform any other update. *

* For new authenticators, the whole object data must be persisted. *

* The function signature is as follows: *

* (Authenticator) -> Future * *

    *
  • the authenticator data to update.
  • *
  • async result of the operation.
  • *
* @param updater updater function. * @return fluent self. */ public io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth authenticatorUpdater(java.util.function.Function> updater) { delegate.authenticatorUpdater(new Function>() { public io.vertx.core.Future apply(io.vertx.ext.auth.otp.Authenticator arg) { io.vertx.core.Future ret = updater.apply(arg); return ret.map(val -> val); } }); return this; } /** * Provide a that can update or insert a . * The function should store a given authenticator to a persistence storage. *

* When an authenticator is already present, this method must at least update * , and is not required to perform any other update. *

* For new authenticators, the whole object data must be persisted. *

* The function signature is as follows: *

* (Authenticator) -> Future * *

    *
  • the authenticator data to update.
  • *
  • async result of the operation.
  • *
* @param updater updater function. * @return fluent self. */ public io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth authenticatorUpdater(io.reactivex.functions.Function updater) { delegate.authenticatorUpdater(new Function>() { public io.vertx.core.Future apply(io.vertx.ext.auth.otp.Authenticator arg) { io.reactivex.Completable ret; try { ret = updater.apply(arg); } catch (Exception e) { return io.vertx.core.Future.failedFuture(e); } return io.vertx.reactivex.CompletableHelper.toFuture(ret); } }); return this; } /** * Creating authenticator from user id and key. * @param id id user. * @param otpKey key of user used for auth. * @return an object containing all the necessary information to authenticate a user. */ public io.vertx.core.Future createAuthenticator(java.lang.String id, io.vertx.ext.auth.otp.OtpKey otpKey) { io.vertx.core.Future ret = delegate.createAuthenticator(id, otpKey).map(val -> val); return ret; } /** * Creating authenticator from user id and key. * @param id id user. * @param otpKey key of user used for auth. * @return an object containing all the necessary information to authenticate a user. */ public io.reactivex.Single rxCreateAuthenticator(java.lang.String id, io.vertx.ext.auth.otp.OtpKey otpKey) { return AsyncResultSingle.toSingle($handler -> { this.createAuthenticator(id, otpKey).onComplete($handler); }); } /** * Creating URI for register in key in user device. * @param otpKey user key. * @param issuer issuer of key. * @param user display name of user account. * @param label the label to identify which account a key is associated with. * @return uri containing the key. */ public java.lang.String generateUri(io.vertx.ext.auth.otp.OtpKey otpKey, java.lang.String issuer, java.lang.String user, java.lang.String label) { java.lang.String ret = delegate.generateUri(otpKey, issuer, user, label); return ret; } /** * Creating URI for register in key in user device. * @param otpKey user key. * @param issuer issuer of key. * @param user display name of user account. * @return uri containing the key. */ public java.lang.String generateUri(io.vertx.ext.auth.otp.OtpKey otpKey, java.lang.String issuer, java.lang.String user) { java.lang.String ret = delegate.generateUri(otpKey, issuer, user); return ret; } /** * Creating URI for register in key in user device. * @param otpKey user key. * @param label the label to identify which account a key is associated with. * @return uri containing the key. */ public java.lang.String generateUri(io.vertx.ext.auth.otp.OtpKey otpKey, java.lang.String label) { java.lang.String ret = delegate.generateUri(otpKey, label); return ret; } /** * Creates an instance of HotpAuth. * @return the created instance of {@link io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth}. */ public static io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth create() { io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth ret = io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth.newInstance((io.vertx.ext.auth.otp.hotp.HotpAuth)io.vertx.ext.auth.otp.hotp.HotpAuth.create()); return ret; } /** * Creates an instance of HotpAuth. * @param hotpAuthOptions the config. * @return the created instance of {@link io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth}. */ public static io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth create(io.vertx.ext.auth.otp.hotp.HotpAuthOptions hotpAuthOptions) { io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth ret = io.vertx.reactivex.ext.auth.otp.hotp.HotpAuth.newInstance((io.vertx.ext.auth.otp.hotp.HotpAuth)io.vertx.ext.auth.otp.hotp.HotpAuth.create(hotpAuthOptions)); return ret; } public static HotpAuth newInstance(io.vertx.ext.auth.otp.hotp.HotpAuth arg) { return arg != null ? new HotpAuth(arg) : null; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy