/** * <p>Checks if the given {@link ProviderType} is supported by the handler.</p> * * @return */ private boolean isSupportedProviderType(ProviderType providerType) { if (providerType == null) { throw logger.nullArgumentError("ProviderType configuration."); } return (providerType instanceof IDPType) || (providerType instanceof SPType); }
public IssuerInfoHolder(NameIDType issuer) { if (issuer == null) throw logger.nullArgumentError("issuer"); this.issuer = issuer; }
public SecurityTokenProvider getProviderForTokenType(String tokenType) { if (tokenType == null) throw logger.nullArgumentError("tokenType"); return this.tokenProviders.get(tokenType); }
public AbstractJPARegistry(String configuration) { if (configuration == null) throw logger.nullArgumentError("JPA configuration name"); this.factory = Persistence.createEntityManagerFactory(configuration); }
/** * Set the {@link Dispatch} object for use * * @param dispatch */ public void setDispatch(Dispatch<Source> dispatch) { if (dispatch == null) throw logger.nullArgumentError("dispatch"); dispatchLocal.set(dispatch); }
/** * Given a string, trim it * * @param str * @return * @throws {@code IllegalArgumentException} if the passed str is null */ public static final String trim(String str) { if (str == null) throw logger.nullArgumentError("String to trim"); return str.trim(); }
private static String getToken(String queryString, String token) { if (queryString == null) throw logger.nullArgumentError("queryString"); token += "="; int start = queryString.indexOf(token); if (start < 0) return null; int end = queryString.indexOf("&", start); if (end == -1) return queryString.substring(start); return queryString.substring(start, end); }
public SecurityTokenProvider getProviderForService(String serviceName) { if (serviceName == null) throw logger.nullArgumentError("serviceName"); ServiceProviderType provider = this.spMetadata.get(serviceName); if (provider != null) { return this.tokenProviders.get(provider.getTokenType()); } return null; }
/** * Apply base64 decoding on the message and return the byte array * * @param encodedString * * @return */ public static byte[] base64Decode(String encodedString) { if (encodedString == null) throw logger.nullArgumentError("encodedString"); //$NON-NLS-1$ return Base64.decode(encodedString); }
protected void checkDestination(String destination, String expectedDestination) throws ProcessingException { if (expectedDestination == null) { throw logger.nullArgumentError("Expected destination."); } if (destination != null) { if (!destination.startsWith(expectedDestination)) { throw new ProcessingException("Invalid destination [" + destination + "]. Expected [" + expectedDestination + "]."); } } }
private IDPType getConfiguration() { IDPType configuration = (IDPType) handlerChainConfig.getParameter(GeneralConstants.CONFIGURATION); if (configuration == null) { throw logger.nullArgumentError("IDP Configuration"); } return configuration; }
/** * Apply base64 decoding on the message and return the byte array * * @param encodedString * * @return */ public static byte[] base64Decode(String encodedString) { if (encodedString == null) throw logger.nullArgumentError("encodedString"); return Base64.decode(encodedString); }
public SamlCredential(final Element assertion) { if (assertion == null) throw logger.nullArgumentError("assertion"); this.assertion = SamlCredential.assertionToString(assertion); }
/** * Apply base64 decoding on the message and return the stream * * @param encodedString * * @return */ public static InputStream base64DecodeAsStream(String encodedString) { if (encodedString == null) throw logger.nullArgumentError("encodedString"); return new ByteArrayInputStream(base64Decode(encodedString)); }
public SamlCredential(final String assertion) { if (StringUtil.isNullOrEmpty(assertion)) throw logger.nullArgumentError("assertion"); this.assertion = assertion; }
/** * Apply base64 decoding on the message and return the stream * * @param encodedString * * @return */ public static InputStream base64DecodeAsStream(String encodedString) { if (encodedString == null) throw logger.nullArgumentError("encodedString"); //$NON-NLS-1$ return new ByteArrayInputStream(base64Decode(encodedString)); }
private PublicKey getSenderPublicKey(SAML2HandlerRequest request) { PublicKey publicKey = getPublicKeyFromMetadata(request); if (publicKey != null) { return publicKey; } publicKey = (PublicKey) request.getOptions().get(GeneralConstants.SENDER_PUBLIC_KEY); if (publicKey == null) { throw logger.nullArgumentError("Sender Public Key"); } return publicKey; }
public IssuerInfoHolder(String issuerAsString) { if (issuerAsString == null) throw logger.nullArgumentError("issuerAsString"); issuer = new NameIDType(); issuer.setValue(issuerAsString); }
public static PicketLinkType getConfiguration(InputStream is) throws ParsingException { if (is == null) throw logger.nullArgumentError("inputstream"); PicketLinkConfigParser parser = new PicketLinkConfigParser(); PicketLinkType picketLinkType = (PicketLinkType) parser.parse(is); return picketLinkType; }
public static SAML2HandlerChain createChain(String fqn) throws ProcessingException { if (fqn == null) throw logger.nullArgumentError("fqn"); Class<?> clazz = SecurityActions.loadClass(SAML2HandlerChainFactory.class, fqn); if (clazz == null) throw logger.classNotLoadedError(fqn); try { return (SAML2HandlerChain) clazz.newInstance(); } catch (Exception e) { throw logger.couldNotCreateInstance(fqn, e); } } }