/*
* 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.oauth2;
import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.vertx.core.json.JsonObject;
import io.vertx.core.AsyncResult;
import io.vertx.ext.auth.oauth2.OAuth2FlowType;
import io.vertx.core.Handler;
import io.vertx.ext.auth.oauth2.OAuth2ClientOptions;
Factory interface for creating OAuth2 based AuthProvider
instances. NOTE: This class has been automatically generated from the original
non RX-ified interface using Vert.x codegen. /**
* Factory interface for creating OAuth2 based {@link io.vertx.reactivex.ext.auth.AuthProvider} instances.
*
* <p/>
* NOTE: This class has been automatically generated from the {@link io.vertx.ext.auth.oauth2.OAuth2Auth original} non RX-ified interface using Vert.x codegen.
*/
@io.vertx.lang.rx.RxGen(io.vertx.ext.auth.oauth2.OAuth2Auth.class)
public class OAuth2Auth extends io.vertx.reactivex.ext.auth.AuthProvider {
@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;
OAuth2Auth that = (OAuth2Auth) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public static final io.vertx.lang.rx.TypeArg<OAuth2Auth> __TYPE_ARG = new io.vertx.lang.rx.TypeArg<>( obj -> new OAuth2Auth((io.vertx.ext.auth.oauth2.OAuth2Auth) obj),
OAuth2Auth::getDelegate
);
private final io.vertx.ext.auth.oauth2.OAuth2Auth delegate;
public OAuth2Auth(io.vertx.ext.auth.oauth2.OAuth2Auth delegate) {
super(delegate);
this.delegate = delegate;
}
public io.vertx.ext.auth.oauth2.OAuth2Auth getDelegate() {
return delegate;
}
Params: - vertx – the Vertx instance
- flow –
- config – the config as exported from the admin console
Returns: the auth provider
/**
* @param vertx the Vertx instance
* @param flow
* @param config the config as exported from the admin console
* @return the auth provider
*/
@Deprecated()
public static io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth createKeycloak(io.vertx.reactivex.core.Vertx vertx, OAuth2FlowType flow, JsonObject config) {
io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth ret = io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth.newInstance(io.vertx.ext.auth.oauth2.OAuth2Auth.createKeycloak(vertx.getDelegate(), flow, config));
return ret;
}
Create a OAuth2 auth provider
Params: - vertx – the Vertx instance
- flow –
- config – the config
Returns: the auth provider
/**
* Create a OAuth2 auth provider
* @param vertx the Vertx instance
* @param flow
* @param config the config
* @return the auth provider
*/
@Deprecated()
public static io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth create(io.vertx.reactivex.core.Vertx vertx, OAuth2FlowType flow, OAuth2ClientOptions config) {
io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth ret = io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth.newInstance(io.vertx.ext.auth.oauth2.OAuth2Auth.create(vertx.getDelegate(), flow, config));
return ret;
}
Create a OAuth2 auth provider
Params: - vertx – the Vertx instance
- flow –
Returns: the auth provider
/**
* Create a OAuth2 auth provider
* @param vertx the Vertx instance
* @param flow
* @return the auth provider
*/
@Deprecated()
public static io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth create(io.vertx.reactivex.core.Vertx vertx, OAuth2FlowType flow) {
io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth ret = io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth.newInstance(io.vertx.ext.auth.oauth2.OAuth2Auth.create(vertx.getDelegate(), flow));
return ret;
}
Create a OAuth2 auth provider
Params: - vertx – the Vertx instance
Returns: the auth provider
/**
* Create a OAuth2 auth provider
* @param vertx the Vertx instance
* @return the auth provider
*/
public static io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth create(io.vertx.reactivex.core.Vertx vertx) {
io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth ret = io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth.newInstance(io.vertx.ext.auth.oauth2.OAuth2Auth.create(vertx.getDelegate()));
return ret;
}
Create a OAuth2 auth provider
Params: - vertx – the Vertx instance
- config – the config
Returns: the auth provider
/**
* Create a OAuth2 auth provider
* @param vertx the Vertx instance
* @param config the config
* @return the auth provider
*/
public static io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth create(io.vertx.reactivex.core.Vertx vertx, OAuth2ClientOptions config) {
io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth ret = io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth.newInstance(io.vertx.ext.auth.oauth2.OAuth2Auth.create(vertx.getDelegate(), config));
return ret;
}
Generate a redirect URL to the authN/Z backend. It only applies to auth_code flow.
Params: - params –
Returns:
/**
* Generate a redirect URL to the authN/Z backend. It only applies to auth_code flow.
* @param params
* @return
*/
public String authorizeURL(JsonObject params) {
String ret = delegate.authorizeURL(params);
return ret;
}
Returns the Access Token object.
Params: - params – - JSON with the options, each flow requires different options.
- handler – - The handler returning the results.
/**
* Returns the Access Token object.
* @param params - JSON with the options, each flow requires different options.
* @param handler - The handler returning the results.
*/
@Deprecated()
public void getToken(JsonObject params, Handler<AsyncResult<io.vertx.reactivex.ext.auth.oauth2.AccessToken>> handler) {
delegate.getToken(params, new Handler<AsyncResult<io.vertx.ext.auth.oauth2.AccessToken>>() {
public void handle(AsyncResult<io.vertx.ext.auth.oauth2.AccessToken> ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.reactivex.ext.auth.oauth2.AccessToken.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
}
Returns the Access Token object.
Params: - params – - JSON with the options, each flow requires different options.
Returns:
/**
* Returns the Access Token object.
* @param params - JSON with the options, each flow requires different options.
* @return
*/
@Deprecated()
public Single<io.vertx.reactivex.ext.auth.oauth2.AccessToken> rxGetToken(JsonObject params) {
return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> {
getToken(params, handler);
});
}
Decode a token to a AccessToken
object. This is useful to handle bearer JWT tokens. Params: - token – the access token (base64 string)
- handler – A handler to receive the event
Returns: self
/**
* Decode a token to a {@link io.vertx.reactivex.ext.auth.oauth2.AccessToken} object. This is useful to handle bearer JWT tokens.
* @param token the access token (base64 string)
* @param handler A handler to receive the event
* @return self
*/
@Deprecated()
public io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth decodeToken(String token, Handler<AsyncResult<io.vertx.reactivex.ext.auth.oauth2.AccessToken>> handler) {
delegate.decodeToken(token, new Handler<AsyncResult<io.vertx.ext.auth.oauth2.AccessToken>>() {
public void handle(AsyncResult<io.vertx.ext.auth.oauth2.AccessToken> ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.reactivex.ext.auth.oauth2.AccessToken.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
Decode a token to a AccessToken
object. This is useful to handle bearer JWT tokens. Params: - token – the access token (base64 string)
Returns: self
/**
* Decode a token to a {@link io.vertx.reactivex.ext.auth.oauth2.AccessToken} object. This is useful to handle bearer JWT tokens.
* @param token the access token (base64 string)
* @return self
*/
@Deprecated()
public Single<io.vertx.reactivex.ext.auth.oauth2.AccessToken> rxDecodeToken(String token) {
return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> {
decodeToken(token, handler);
});
}
Query an OAuth 2.0 authorization server to determine the active state of an OAuth 2.0 token and to determine
meta-information about this token.
Params: - token – the access token (base64 string)
- handler – A handler to receive the event
Returns: self
/**
* Query an OAuth 2.0 authorization server to determine the active state of an OAuth 2.0 token and to determine
* meta-information about this token.
* @param token the access token (base64 string)
* @param handler A handler to receive the event
* @return self
*/
public io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth introspectToken(String token, Handler<AsyncResult<io.vertx.reactivex.ext.auth.oauth2.AccessToken>> handler) {
delegate.introspectToken(token, new Handler<AsyncResult<io.vertx.ext.auth.oauth2.AccessToken>>() {
public void handle(AsyncResult<io.vertx.ext.auth.oauth2.AccessToken> ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.reactivex.ext.auth.oauth2.AccessToken.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
Query an OAuth 2.0 authorization server to determine the active state of an OAuth 2.0 token and to determine
meta-information about this token.
Params: - token – the access token (base64 string)
Returns: self
/**
* Query an OAuth 2.0 authorization server to determine the active state of an OAuth 2.0 token and to determine
* meta-information about this token.
* @param token the access token (base64 string)
* @return self
*/
public Single<io.vertx.reactivex.ext.auth.oauth2.AccessToken> rxIntrospectToken(String token) {
return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> {
introspectToken(token, handler);
});
}
Query an OAuth 2.0 authorization server to determine the active state of an OAuth 2.0 token and to determine
meta-information about this token.
Params: - token – the access token (base64 string)
- tokenType – hint to the token type e.g.: `access_token`
- handler – A handler to receive the event
Returns: self
/**
* Query an OAuth 2.0 authorization server to determine the active state of an OAuth 2.0 token and to determine
* meta-information about this token.
* @param token the access token (base64 string)
* @param tokenType hint to the token type e.g.: `access_token`
* @param handler A handler to receive the event
* @return self
*/
public io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth introspectToken(String token, String tokenType, Handler<AsyncResult<io.vertx.reactivex.ext.auth.oauth2.AccessToken>> handler) {
delegate.introspectToken(token, tokenType, new Handler<AsyncResult<io.vertx.ext.auth.oauth2.AccessToken>>() {
public void handle(AsyncResult<io.vertx.ext.auth.oauth2.AccessToken> ar) {
if (ar.succeeded()) {
handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.reactivex.ext.auth.oauth2.AccessToken.newInstance(ar.result())));
} else {
handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
}
}
});
return this;
}
Query an OAuth 2.0 authorization server to determine the active state of an OAuth 2.0 token and to determine
meta-information about this token.
Params: - token – the access token (base64 string)
- tokenType – hint to the token type e.g.: `access_token`
Returns: self
/**
* Query an OAuth 2.0 authorization server to determine the active state of an OAuth 2.0 token and to determine
* meta-information about this token.
* @param token the access token (base64 string)
* @param tokenType hint to the token type e.g.: `access_token`
* @return self
*/
public Single<io.vertx.reactivex.ext.auth.oauth2.AccessToken> rxIntrospectToken(String token, String tokenType) {
return io.vertx.reactivex.impl.AsyncResultSingle.toSingle(handler -> {
introspectToken(token, tokenType, handler);
});
}
Returns the scope separator.
The RFC 6749 states that a scope is expressed as a set of case-sensitive and space-delimited strings, however
vendors tend not to agree on this and we see the following cases being used: space, plus sign, comma.
Returns: what value was used in the configuration of the object, falling back to the default value which is a space.
/**
* Returns the scope separator.
*
* The RFC 6749 states that a scope is expressed as a set of case-sensitive and space-delimited strings, however
* vendors tend not to agree on this and we see the following cases being used: space, plus sign, comma.
* @return what value was used in the configuration of the object, falling back to the default value which is a space.
*/
@Deprecated()
public String getScopeSeparator() {
String ret = delegate.getScopeSeparator();
return ret;
}
Returns the configured flow type for the Oauth2 provider.
Returns: the flow type.
/**
* Returns the configured flow type for the Oauth2 provider.
* @return the flow type.
*/
public OAuth2FlowType getFlowType() {
OAuth2FlowType ret = delegate.getFlowType();
return ret;
}
Loads a JWK Set from the remote provider.
When calling this method several times, the loaded JWKs are updated in the underlying JWT object.
Params: - handler –
Returns:
/**
* Loads a JWK Set from the remote provider.
*
* When calling this method several times, the loaded JWKs are updated in the underlying JWT object.
* @param handler
* @return
*/
public io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth loadJWK(Handler<AsyncResult<Void>> handler) {
delegate.loadJWK(handler);
return this;
}
Loads a JWK Set from the remote provider.
When calling this method several times, the loaded JWKs are updated in the underlying JWT object.
Returns:
/**
* Loads a JWK Set from the remote provider.
*
* When calling this method several times, the loaded JWKs are updated in the underlying JWT object.
* @return
*/
public Completable rxLoadJWK() {
return io.vertx.reactivex.impl.AsyncResultCompletable.toCompletable(handler -> {
loadJWK(handler);
});
}
public io.vertx.reactivex.ext.auth.oauth2.OAuth2Auth rbacHandler(io.vertx.reactivex.ext.auth.oauth2.OAuth2RBAC rbac) {
delegate.rbacHandler(rbac.getDelegate());
return this;
}
public static OAuth2Auth newInstance(io.vertx.ext.auth.oauth2.OAuth2Auth arg) {
return arg != null ? new OAuth2Auth(arg) : null;
}
}