/*
* 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.authorization;
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.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;
Scope is a mechanism in OAuth 2.0 to limit an application's access to a user's account.
An application can request one or more scopes, this information is then presented to the
user in the consent screen, and the access token issued to the application will be
limited to the scopes granted.
The OAuth spec allows the authorization server or user to modify the scopes granted to
the application compared to what is requested, although there are not many examples of
services doing this in practice.
OAuth2 does not define any particular values for scopes, since it is highly dependent
on the service's internal architecture and needs.
NOTE: This class has been automatically generated from the original
non RX-ified interface using Vert.x codegen. /**
* Scope is a mechanism in OAuth 2.0 to limit an application's access to a user's account.
* An application can request one or more scopes, this information is then presented to the
* user in the consent screen, and the access token issued to the application will be
* limited to the scopes granted.
*
* The OAuth spec allows the authorization server or user to modify the scopes granted to
* the application compared to what is requested, although there are not many examples of
* services doing this in practice.
*
* OAuth2 does not define any particular values for scopes, since it is highly dependent
* on the service's internal architecture and needs.
*
* <p/>
* NOTE: This class has been automatically generated from the {@link io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization original} non RX-ified interface using Vert.x codegen.
*/
@RxGen(io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization.class)
public class ScopeAuthorization extends io.vertx.reactivex.ext.auth.authorization.AuthorizationProvider {
@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;
ScopeAuthorization that = (ScopeAuthorization) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public static final TypeArg<ScopeAuthorization> __TYPE_ARG = new TypeArg<>( obj -> new ScopeAuthorization((io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization) obj),
ScopeAuthorization::getDelegate
);
private final io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization delegate;
public ScopeAuthorization(io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization delegate) {
super(delegate);
this.delegate = delegate;
}
public ScopeAuthorization(Object delegate) {
super((io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization)delegate);
this.delegate = (io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization)delegate;
}
public io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization getDelegate() {
return delegate;
}
Factory method to create a Authorization provider for Oauth 2.0 scopes.
Params: - scopeSeparator – the scope separator e.g.:
" "
, ","
, "+"
Returns: a AuthorizationProvider
/**
* Factory method to create a Authorization provider for Oauth 2.0 scopes.
* @param scopeSeparator the scope separator e.g.: <code>" "</code>, <code>","</code>, <code>"+"</code>
* @return a AuthorizationProvider
*/
public static io.vertx.reactivex.ext.auth.oauth2.authorization.ScopeAuthorization create(String scopeSeparator) {
io.vertx.reactivex.ext.auth.oauth2.authorization.ScopeAuthorization ret = io.vertx.reactivex.ext.auth.oauth2.authorization.ScopeAuthorization.newInstance((io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization)io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization.create(scopeSeparator));
return ret;
}
Returns the configured separator.
Returns: the separator.
/**
* Returns the configured separator.
* @return the separator.
*/
public String separator() {
String ret = delegate.separator();
return ret;
}
Returns a String with the given scopes concatenated with the given separator.
Params: - scopes – a list of scopes
Returns: concatenated string.
/**
* Returns a String with the given scopes concatenated with the given separator.
* @param scopes a list of scopes
* @return concatenated string.
*/
public String encode(List<String> scopes) {
String ret = delegate.encode(scopes);
return ret;
}
public static ScopeAuthorization newInstance(io.vertx.ext.auth.oauth2.authorization.ScopeAuthorization arg) {
return arg != null ? new ScopeAuthorization(arg) : null;
}
}