WebFinger.java revision f6f832d45ed206ed045a2e3e541ae0f2fd34cc0c
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2013-2016 ForgeRock AS.
*/
/**
* Sets up the OpenId Connect web finger endpoints and their handlers.
*
* @since 11.0.0
*/
public class WebFinger extends Application {
private final RestRealmValidator realmValidator;
private final CoreWrapper coreWrapper;
private final AuditEventPublisher eventPublisher;
private final AuditEventFactory eventFactory;
/**
* Constructs a new WebFinger.
* <br/>
* Sets the default media type to {@link MediaType#APPLICATION_JSON} and sets the status service to
* {@link OAuth2StatusService}.
*/
public WebFinger() {
getMetadataService().setEnabled(true);
setStatusService(new OAuth2StatusService());
}
/**
* Creates the endpoint handler registrations for the OpenId Connect web finger endpoints.
*
* @return {@inheritDoc}
*/
public Restlet createInboundRoot() {
/**
* For now we only use webfinger for OpenID Connect. Once the standard is finalized
* or we decide to use it for other tasks we dont need a full blown handler
*/
root.attach("/webfinger", auditWithOAuthFilter(new GuicedRestlet(getContext(), OpenIDConnectDiscovery.class)));
return root;
}
return new OAuth2AccessAuditFilter(restlet, eventPublisher, eventFactory, requestFactory, noBodyAuditor(),
noBodyAuditor());
}
}