Example usage for com.google.common.base Functions compose

List of usage examples for com.google.common.base Functions compose

Introduction

In this page you can find the example usage for com.google.common.base Functions compose.

Prototype

public static <A, B, C> Function<A, C> compose(Function<B, C> g, Function<A, ? extends B> f) 

Source Link

Document

Returns the composition of two functions.

Usage

From source file:org.opensaml.profile.action.impl.PopulateDecryptionParameters.java

/**
 * Constructor.// w  ww  . ja  v  a  2 s  .  co  m
 */
public PopulateDecryptionParameters() {
    // Create context by default.
    securityParametersContextLookupStrategy = Functions.compose(
            new ChildContextLookup<>(SecurityParametersContext.class, true), new InboundMessageContextLookup());
}

From source file:net.shibboleth.idp.authn.impl.FilterFlowsByAttribute.java

/** Constructor. */
public FilterFlowsByAttribute() {
    attributeContextLookupStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, AuthenticationContext>(AuthenticationContext.class));
    filterActiveResults = true;//from   w w w .  j av  a2s .c  o m
}

From source file:net.shibboleth.idp.saml.saml2.profile.impl.FilterByQueriedAttributes.java

/**
 * Constructor.//  ww w  .j  av a 2  s. c o  m
 * 
 * @param mapper mapper used to consume designators
 */
public FilterByQueriedAttributes(@Nonnull final SAML2AttributesMapperService mapper) {
    mapperService = Constraint.isNotNull(mapper, "MapperService cannot be null");

    attributeContextLookupStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class));

    queryLookupStrategy = Functions.compose(new MessageLookup(AttributeQuery.class),
            new InboundMessageContextLookup());
}

From source file:org.opensaml.saml.common.profile.impl.SignAssertions.java

/** Constructor. */
public SignAssertions() {
    responseLookupStrategy = Functions.compose(new MessageLookup<>(SAMLObject.class),
            new OutboundMessageContextLookup());
    securityParametersLookupStrategy = new ChildContextLookup<>(SecurityParametersContext.class);
}

From source file:fi.csc.idp.stepup.impl.InitializeStepUpChallengeContext.java

/** Constructor. */
public InitializeStepUpChallengeContext() {

    attributeContextLookupStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class));

}

From source file:fi.vm.kapa.identification.shibboleth.extattribute.ShibbolethExtAttributeConnector.java

private boolean tokenRequired(ProfileRequestContext prc) {
    Function<ProfileRequestContext, SAMLMetadataContext> metadataContextLookupStrategy;
    metadataContextLookupStrategy = Functions.compose(new ChildContextLookup<>(SAMLMetadataContext.class),
            Functions.compose(new ChildContextLookup<>(SAMLPeerEntityContext.class),
                    new OutboundMessageContextLookup()));

    final SAMLMetadataContext metadataContext = metadataContextLookupStrategy.apply(prc);
    boolean tokenRequired = false;
    if (metadataContext != null) {
        logger.debug("Metadata context found");
        EntityDescriptor entityDescriptor = metadataContext.getEntityDescriptor();
        SPSSODescriptor spssoDescriptor = entityDescriptor
                .getSPSSODescriptor("urn:oasis:names:tc:SAML:2.0:protocol");
        List<AttributeConsumingService> attributeConsumingServices = spssoDescriptor
                .getAttributeConsumingServices();
        Iterator<AttributeConsumingService> acsiter = attributeConsumingServices.iterator();
        while (acsiter.hasNext()) {
            AttributeConsumingService acs = acsiter.next();
            logger.debug("ATTRIBUTE CONSUMING SERVICE");
            List<RequestedAttribute> requestAttributes = acs.getRequestAttributes();
            for (RequestedAttribute ra : requestAttributes) {
                if (REQUESTED_ATTRIBUTE_NAME_AUTHENTICATION_TOKEN.equals(ra.getName())) {
                    tokenRequired = true;
                    break;
                }/*from   ww  w  . j  ava2s.c  o  m*/
            }
        }
    } else {
        logger.warn("Metadata context is null");
    }

    logger.debug("tokenRequired: " + tokenRequired);
    return tokenRequired;
}

From source file:net.shibboleth.idp.attribute.filter.matcher.saml.impl.MappedAttributeInMetadataMatcher.java

/** Constructor. */
public MappedAttributeInMetadataMatcher() {
    objectStrategy = Functions.compose(new AttributeConsumerServiceLookupFunction(),
            new ChildContextLookup<SAMLMetadataContext, AttributeConsumingServiceContext>(
                    AttributeConsumingServiceContext.class));
}

From source file:org.apache.aurora.scheduler.metadata.NearestFit.java

/**
 * Records a task deletion event.//  w ww . j  a  v a  2  s .  c  om
 *
 * @param deletedEvent Task deleted event.
 */
@Subscribe
public synchronized void remove(TasksDeleted deletedEvent) {
    fitByGroupKey.invalidateAll(Iterables.transform(deletedEvent.getTasks(),
            Functions.compose(TaskGroupKey::from, Tasks::getConfig)));
}

From source file:com.nesscomputing.jdbc.C3P0DataSourceProvider.java

@Inject(optional = true)
void injectDependencies(final Injector injector) {
    final Binding<Set<Function<DataSource, DataSource>>> datasourceBindings = injector
            .getExistingBinding(Key.get(new TypeLiteral<Set<Function<DataSource, DataSource>>>() {
            }, annotation));//from ww  w  .j a va 2 s. c  o m
    if (datasourceBindings != null) {
        for (Function<DataSource, DataSource> fn : datasourceBindings.getProvider().get()) {
            dataSourceWrapper = Functions.compose(dataSourceWrapper, fn);
        }
    }

    final Binding<Properties> propertiesBinding = injector
            .getExistingBinding(Key.get(Properties.class, annotation));
    if (propertiesBinding != null) {
        props = propertiesBinding.getProvider().get();
    }
    final Binding<URI> uriBinding = injector.getExistingBinding(Key.get(URI.class, annotation));
    if (uriBinding != null) {
        uri = uriBinding.getProvider().get();
        Preconditions.checkArgument(uri != null, "the preset database URI must not be null!");
    }

}

From source file:org.opensaml.saml.saml2.profile.impl.AbstractDecryptAction.java

/** Constructor. */
public AbstractDecryptAction() {
    errorFatal = true;//  w  w w.ja  va 2 s .c  o m
    securityParamsLookupStrategy = Functions.compose(new ChildContextLookup<>(SecurityParametersContext.class),
            new InboundMessageContextLookup());
    messageLookupStrategy = Functions.compose(new MessageLookup<>(Object.class),
            new InboundMessageContextLookup());
    decryptionPredicate = Predicates.alwaysTrue();
}