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

no.nav.brukerdialog.tools.Utils Maven / Gradle / Ivy

There is a newer version: 1.2020.02.21_14.01-cdaccec525a6
Show newest version
package no.nav.brukerdialog.tools;


import no.nav.brukerdialog.security.oidc.OidcTokenException;

import java.util.List;

import static java.util.Arrays.asList;

public class Utils {

    public static String getSystemProperty(String propertyName) {
        String property = System.getProperty(propertyName);
        if (property == null || property.trim().length() == 0) {
            throw new OidcTokenException("Mangler system property: " + propertyName);
        }
        return property;
    }

    public static List getCommaSeparatedUsers(String users) {
        return asList(users.trim().toLowerCase().split(","));
    }

    public static String getRelativePath(String path) {
        if (path == null) {
            return path;
        } else if (!path.contains("http")) {
            return path;
        }
        return path.replaceAll(".*:\\/\\/[^\\/]*\\/", "/");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy