Example usage for android.net Uri getEncodedUserInfo

List of usage examples for android.net Uri getEncodedUserInfo

Introduction

In this page you can find the example usage for android.net Uri getEncodedUserInfo.

Prototype

@Nullable
public abstract String getEncodedUserInfo();

Source Link

Document

Gets the encoded user information from the authority.

Usage

From source file:net.openid.appauthdemo.Configuration.java

@NonNull
Uri getRequiredConfigUri(String propName) throws InvalidConfigurationException {
    String uriStr = getRequiredConfigString(propName);
    Uri uri;
    try {/*  w w w  .  j  a  v a  2  s .  c o  m*/
        uri = Uri.parse(uriStr);
    } catch (Throwable ex) {
        throw new InvalidConfigurationException(propName + " could not be parsed", ex);
    }

    if (!uri.isHierarchical() || !uri.isAbsolute()) {
        throw new InvalidConfigurationException(propName + " must be hierarchical and absolute");
    }

    if (!TextUtils.isEmpty(uri.getEncodedUserInfo())) {
        throw new InvalidConfigurationException(propName + " must not have user info");
    }

    if (!TextUtils.isEmpty(uri.getEncodedQuery())) {
        throw new InvalidConfigurationException(propName + " must not have query parameters");
    }

    if (!TextUtils.isEmpty(uri.getEncodedFragment())) {
        throw new InvalidConfigurationException(propName + " must not have a fragment");
    }

    return uri;
}