Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
147 lines (125 sloc) 6.26 KB
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://cxf.apache.org/configuration/security"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:jaxrs-client="http://cxf.apache.org/jaxrs-client"
xsi:schemaLocation="
http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/configuration/security.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/transports/http-jetty/configuration
http://cxf.apache.org/schemas/configuration/http-jetty.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs-client http://cxf.apache.org/schemas/jaxrs-client.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
<bean id="serviceBean" class="org.apache.coheigea.cxf.fediz.oidc.service.DoubleItService"/>
<bean id="contextManager" class="org.apache.cxf.rs.security.oauth2.client.MemoryClientTokenContextManager"/>
<bean id="authorizationInterceptor"
class="org.apache.cxf.interceptor.security.SecureAnnotationsInterceptor">
<property name="securedObject" ref="serviceBean" />
</bean>
<bean id="authServiceFilter"
class="org.apache.cxf.rs.security.oidc.rp.OidcRpAuthenticationFilter">
<property name="clientTokenContextManager" ref="contextManager" />
<property name="redirectUri" value="https://localhost:${rp.https.port}/fedizdoubleit/auth/rp" />
<property name="roleClaim" value="role"/>
<property name="addRequestUriAsRedirectQuery" value="true"/>
</bean>
<jaxrs:server address="/app1">
<jaxrs:serviceBeans>
<ref bean="serviceBean"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="authServiceFilter"/>
</jaxrs:providers>
<jaxrs:inInterceptors>
<ref bean="authorizationInterceptor"/>
</jaxrs:inInterceptors>
</jaxrs:server>
<bean id="authService" class="org.apache.cxf.rs.security.oidc.rp.OidcRpAuthenticationService">
<property name="defaultLocation" value="https://localhost:${rp.https.port}/fedizdoubleit/app1/doubleit"/>
<property name="clientTokenContextManager" ref="contextManager" />
</bean>
<bean id="stateManager" class="org.apache.cxf.rs.security.oauth2.client.MemoryClientCodeStateManager"/>
<bean id="authFilter"
class="org.apache.cxf.rs.security.oidc.rp.OidcClientCodeRequestFilter">
<property name="authorizationServiceUri" value="https://localhost:${oidc.https.port}/fediz-oidc/idp/authorize"/>
<property name="accessTokenServiceClient" ref="atServiceClient"/>
<property name="clientCodeStateManager" ref="stateManager"/>
<property name="consumer" ref="consumer"/>
<property name="idTokenReader" ref="idTokenReader"/>
<property name="claims" value="role"/>
<property name="startUri" value="/rp"/>
<property name="completeUri" value="/rp/complete"/>
</bean>
<bean id="consumer" class="org.apache.cxf.rs.security.oauth2.client.Consumer">
<property name="key" value="consumer-id"/>
<property name="secret" value="this-is-a-secret"/>
</bean>
<bean id="idTokenReader" class="org.apache.cxf.rs.security.oidc.rp.IdTokenReader">
<property name="issuerId" value="accounts.fediz.com"/>
</bean>
<bean id="clientTokenContextProvider" class="org.apache.cxf.rs.security.oauth2.client.ClientTokenContextProvider"/>
<jaxrs:server address="/auth">
<jaxrs:serviceBeans>
<ref bean="authService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="authFilter"/>
<ref bean="clientTokenContextProvider"/>
</jaxrs:providers>
<jaxrs:properties>
<entry key="rs.security.keystore.type" value="jks" />
<entry key="rs.security.keystore.alias" value="alice"/>
<entry key="rs.security.keystore.password" value="password"/>
<entry key="rs.security.keystore.file" value="oidc.jks" />
<entry key="rs.security.signature.algorithm" value="RS256" />
</jaxrs:properties>
</jaxrs:server>
<jaxrs-client:client id="atServiceClient" serviceClass="org.apache.cxf.jaxrs.client.WebClient"
address="https://localhost:${oidc.https.port}/fediz-oidc/oauth2/token">
<jaxrs-client:headers>
<entry key="Accept" value="application/json"/>
</jaxrs-client:headers>
</jaxrs-client:client>
<http:conduit name="https://localhost.*">
<http:tlsClientParameters disableCNCheck="true">
<sec:trustManagers>
<sec:keyStore type="jks" password="tompass" resource="server.jks"/>
</sec:trustManagers>
</http:tlsClientParameters>
</http:conduit>
</beans>