Java Code Examples for org.gluu.util.StringHelper#isEmpty()
The following examples show how to use
org.gluu.util.StringHelper#isEmpty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserService.java From oxAuth with MIT License | 6 votes |
public String getUserInumByDn(String dn) { if (StringHelper.isEmpty(dn)) { return null; } String peopleDn = getPeopleBaseDn(); if (!dn.toLowerCase().endsWith(peopleDn.toLowerCase())) { return null; } String firstDnPart = dn.substring(0, dn.length() - peopleDn.length()); String[] dnParts = firstDnPart.split(","); if (dnParts.length == 0) { return null; } String userInumPart = dnParts[dnParts.length - 1]; String[] userInumParts = userInumPart.split("="); if ((userInumParts.length == 2) && StringHelper.equalsIgnoreCase(userInumParts[0], "inum")) { return userInumParts[1]; } return null; }
Example 2
Source File: OpenIdService.java From oxTrust with MIT License | 6 votes |
private void loadOpenIdConfiguration() throws IOException { String openIdProvider = appConfiguration.getOxAuthIssuer(); if (StringHelper.isEmpty(openIdProvider)) { throw new ConfigurationException("OpenIdProvider Url is invalid"); } openIdProvider = openIdProvider + "/.well-known/openid-configuration"; final OpenIdConfigurationClient openIdConfigurationClient = new OpenIdConfigurationClient(openIdProvider); final OpenIdConfigurationResponse response = openIdConfigurationClient.execOpenIdConfiguration(); if ((response == null) || (response.getStatus() != 200)) { throw new ConfigurationException("Failed to load oxAuth configuration"); } log.info("Successfully loaded oxAuth configuration"); this.openIdConfiguration = response; }
Example 3
Source File: UpdateTrustRelationshipAction.java From oxTrust with MIT License | 6 votes |
public boolean saveSpMetaDataFileSourceTypeURI() throws IOException { String spMetadataFileName = trustRelationship.getSpMetaDataFN(); boolean emptySpMetadataFileName = StringHelper.isEmpty(spMetadataFileName); if (emptySpMetadataFileName) { spMetadataFileName = shibboleth3ConfService.getSpNewMetadataFileName(this.trustRelationship); this.trustRelationship.setSpMetaDataFN(spMetadataFileName); } String result = shibboleth3ConfService.saveSpMetadataFile(trustRelationship.getSpMetaDataURL(), spMetadataFileName); if (StringHelper.isNotEmpty(result)) { metadataValidationTimer.queue(result); } else { facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to download metadata"); } return StringHelper.isNotEmpty(result); }
Example 4
Source File: AppInitializer.java From oxTrust with MIT License | 6 votes |
@Produces @ApplicationScoped public StringEncrypter getStringEncrypter() throws OxIntializationException { String encodeSalt = configurationFactory.getCryptoConfigurationSalt(); if (StringHelper.isEmpty(encodeSalt)) { throw new OxIntializationException("Encode salt isn't defined"); } try { StringEncrypter stringEncrypter = StringEncrypter.instance(encodeSalt); return stringEncrypter; } catch (EncryptionException ex) { throw new OxIntializationException("Failed to create StringEncrypter instance"); } }
Example 5
Source File: UpdateResourceAction.java From oxTrust with MIT License | 6 votes |
public void searchAvailableScopes() { if (Util.equals(this.oldSearchAvailableScopePattern, this.searchAvailableScopePattern)) { return; } try { List<Scope> resultScopeDescriptions; if (StringHelper.isEmpty(this.searchAvailableScopePattern)) { resultScopeDescriptions = scopeDescriptionService.getAllUmaScopes(100); } else { resultScopeDescriptions = scopeDescriptionService.findUmaScopes(this.searchAvailableScopePattern, 100); } this.availableScopes = SelectableEntityHelper.convertToSelectableEntityModel(resultScopeDescriptions); this.oldSearchAvailableScopePattern = this.searchAvailableScopePattern; selectAddedScopes(); } catch (Exception ex) { log.error("Failed to find scopes", ex); } }
Example 6
Source File: PushApplicationService.java From oxTrust with MIT License | 5 votes |
/** * Build DN string for oxPush Application */ public String getDnForPushApplication(String inum) { String orgDn = organizationService.getDnForOrganization(); if (StringHelper.isEmpty(inum)) { return String.format("ou=application,ou=push,%s", orgDn); } return String.format("inum=%s,ou=application,ou=push,%s", inum, orgDn); }
Example 7
Source File: SectorIdentifierService.java From oxAuth with MIT License | 5 votes |
/** * Build DN string for sector identifier * * @param oxId Sector Identifier oxId * @return DN string for specified sector identifier or DN for sector identifiers branch if oxId is null * @throws Exception */ public String getDnForSectorIdentifier(String oxId) { String sectorIdentifierDn = staticConfiguration.getBaseDn().getSectorIdentifiers(); if (StringHelper.isEmpty(oxId)) { return sectorIdentifierDn; } return String.format("oxId=%s,%s", oxId, sectorIdentifierDn); }
Example 8
Source File: UpdateClientAction.java From oxTrust with MIT License | 5 votes |
public void removeScope(String inum) { if (StringHelper.isEmpty(inum)) { return; } for (Scope scope : this.scopes) { if (scope.getInum().equalsIgnoreCase(inum)) { this.scopes.remove(scope); break; } } }
Example 9
Source File: PropertyUtil.java From oxTrust with MIT License | 5 votes |
public static String escapeString(String value) { if (StringHelper.isEmpty(value)) { return ""; } return escapeComma(StringEscapeUtils.escapeJava(value)); }
Example 10
Source File: PassportService.java From oxTrust with MIT License | 5 votes |
public boolean containsPassportConfiguration() { String configurationDn = getConfigurationDn(); if (StringHelper.isEmpty(configurationDn)) { return false; } return persistenceEntryManager.contains(configurationDn, LdapOxPassportConfiguration.class); }
Example 11
Source File: LanguageBean.java From oxAuth with MIT License | 5 votes |
private Locale getCookieLocale() { String cookieValue = getCookieValue(); if (StringHelper.isEmpty(cookieValue)) { return null; } Locale locale = Locale.forLanguageTag(cookieValue); return locale; }
Example 12
Source File: ExternalUmaClaimsGatheringService.java From oxAuth with MIT License | 5 votes |
public CustomScriptConfiguration getScriptByInum(String inum) { if (StringHelper.isEmpty(inum)) { return null; } return this.scriptInumMap.get(inum); }
Example 13
Source File: RegistrationService.java From oxAuth with MIT License | 5 votes |
/** * Build DN string for U2F register request */ public String getDnForRegisterRequestMessage(String oxId) { final String u2fBaseDn = staticConfiguration.getBaseDn().getU2fBase(); // ou=registration_requests,ou=u2f,o=gluu if (StringHelper.isEmpty(oxId)) { return String.format("ou=registration_requests,%s", u2fBaseDn); } return String.format("oxid=%s,ou=registration_requests,%s", oxId, u2fBaseDn); }
Example 14
Source File: UpdateScopeAction.java From oxTrust with MIT License | 5 votes |
public void removeClaim(String inum) throws Exception { if (StringHelper.isEmpty(inum)) { return; } String removeClaimInum = attributeService.getDnForAttribute(inum); for (Iterator<DisplayNameEntry> iterator = this.claims.iterator(); iterator.hasNext();) { DisplayNameEntry oneClaim = iterator.next(); if (removeClaimInum.equals(oneClaim.getDn())) { iterator.remove(); break; } } }
Example 15
Source File: SamlAcrService.java From oxTrust with MIT License | 5 votes |
public String getDn(String inum) { String orgDn = organizationService.getDnForOrganization(); if (StringHelper.isEmpty(inum)) { return String.format("ou=samlAcrs,%s", orgDn); } return String.format("inum=%s,ou=samlAcrs,%s", inum, orgDn); }
Example 16
Source File: ExternalUmaRptPolicyService.java From oxAuth with MIT License | 5 votes |
public CustomScriptConfiguration getScriptByInum(String inum) { if (StringHelper.isEmpty(inum)) { return null; } return this.scriptInumMap.get(inum); }
Example 17
Source File: CacheRefreshService.java From oxTrust with MIT License | 5 votes |
public Filter createFilter(String customLdapFilter) throws SearchException { if (StringHelper.isEmpty(customLdapFilter)) { return null; } return ldapFilterConverter.convertRawLdapFilterToFilter(customLdapFilter); }
Example 18
Source File: UpdateTrustRelationshipAction.java From oxTrust with MIT License | 5 votes |
private boolean saveSpMetaDataFileSourceTypeFile() throws IOException { String spMetadataFileName = trustRelationship.getSpMetaDataFN(); boolean emptySpMetadataFileName = StringHelper.isEmpty(spMetadataFileName); if ((fileWrapper == null) || (fileWrapper.getInputStream() == null)) { if (emptySpMetadataFileName) { return false; } String filePath = shibboleth3ConfService.getSpMetadataFilePath(spMetadataFileName); if (filePath == null) { return false; } File file = new File(filePath); if (!file.exists()) { return false; } return true; } if (emptySpMetadataFileName) { spMetadataFileName = shibboleth3ConfService.getSpNewMetadataFileName(this.trustRelationship); this.trustRelationship.setSpMetaDataFN(spMetadataFileName); if (trustRelationship.getDn() == null) { String dn = trustService.getDnForTrustRelationShip(this.inum); this.trustRelationship.setDn(dn); trustService.addTrustRelationship(this.trustRelationship); } else { trustService.updateTrustRelationship(this.trustRelationship); } } String result = shibboleth3ConfService.saveSpMetadataFile(spMetadataFileName, fileWrapper.getInputStream()); if (StringHelper.isNotEmpty(result)) { metadataValidationTimer.queue(result); } else { facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to save SP meta-data file. Please check if you provide correct file"); } return StringHelper.isNotEmpty(result); }
Example 19
Source File: PropertyUtil.java From oxTrust with MIT License | 4 votes |
public static boolean isEmptyString(String string) { return StringHelper.isEmpty(string); }
Example 20
Source File: ScopeService.java From oxTrust with MIT License | 3 votes |
/** * Build DN string for scope * * @param inum * scope Inum * @return DN string for specified scope or DN for scopes branch if inum is null * @throws Exception */ public String getDnForScope(String inum) throws Exception { String orgDn = organizationService.getDnForOrganization(); if (StringHelper.isEmpty(inum)) { return String.format("ou=scopes,%s", orgDn); } return String.format("inum=%s,ou=scopes,%s", inum, orgDn); }