![JAR search and dependency download from the Maven repository](/logo.png)
org.id4me.Id4meValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of relying-party-api Show documentation
Show all versions of relying-party-api Show documentation
ID4me RelyingParty API prototype
The newest version!
/*
* Copyright (C) 2016-2020 OX Software GmbH
* Developed by Peter Höbel [email protected]
* See the LICENSE file for licensing conditions
* SPDX-License-Identifier: MIT
*/
package org.id4me;
import java.util.regex.Pattern;
/**
* Provides functionality to validate an ID4me identifier.
*
* @author Peter Hoebel
*/
public class Id4meValidator {
private static final Pattern VALID_EMAIL_ADDRESS_REGEX = Pattern
.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,63}$", Pattern.CASE_INSENSITIVE);
private static final Pattern VALID_DOMAIN_NAME_REGEX = Pattern
.compile("^((?!-)[_A-Za-z0-9-]{1,63}(? 0) {
return VALID_EMAIL_ADDRESS_REGEX.matcher(id4me).find();
} else {
if (id4me.indexOf(".") > 0)
return VALID_DOMAIN_NAME_REGEX.matcher(id4me).find();
else
return VALID_TOP_LEVEL_DOMAIN_NAME_REGEX.matcher(id4me).find();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy