Repository: cxf-fediz Updated Branches: refs/heads/master 6f28a5a15 -> 28dcba96a
Setting homeRealm on Client bean Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/28dcba96 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/28dcba96 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/28dcba96 Branch: refs/heads/master Commit: 28dcba96a420f3623dcfdec90b0f1777ef1ce846 Parents: 6f28a5a Author: Sergey Beryozkin <[email protected]> Authored: Mon Feb 8 16:24:35 2016 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Mon Feb 8 16:24:35 2016 +0000 ---------------------------------------------------------------------- .../service/oidc/ClientRegistrationService.java | 2 +- .../cxf/fediz/service/oidc/FedizClient.java | 57 -------------------- .../handler/hrd/ClientIdHomeRealmDiscovery.java | 8 ++- 3 files changed, 4 insertions(+), 63 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/28dcba96/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java index dfe2a01..ad4e7a8 100644 --- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java +++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/ClientRegistrationService.java @@ -220,7 +220,7 @@ public class ClientRegistrationService { ? generateClientSecret() : null; - FedizClient newClient = new FedizClient(clientId, clientSecret, isConfidential, appName); + Client newClient = new Client(clientId, clientSecret, isConfidential, appName); // User who registered this client String userName = sc.getUserPrincipal().getName(); http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/28dcba96/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizClient.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizClient.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizClient.java deleted file mode 100644 index 261e8f9..0000000 --- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/FedizClient.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * 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. - */ - -package org.apache.cxf.fediz.service.oidc; - -import org.apache.cxf.rs.security.oauth2.common.Client; - -/** - * Extends the OAuth Client by associating a client with a particular realm. - */ -public class FedizClient extends Client { - - private static final long serialVersionUID = -6186868745413555170L; - private String homeRealm; - - public FedizClient() { - super(); - } - - public FedizClient(String clientId, String clientSecret, boolean isConfidential) { - super(clientId, clientSecret, isConfidential); - } - - public FedizClient(String clientId, - String clientSecret, - boolean isConfidential, - String applicationName) { - super(clientId, clientSecret, isConfidential, applicationName); - - } - - public String getHomeRealm() { - return homeRealm; - } - - public void setHomeRealm(String homeRealm) { - this.homeRealm = homeRealm; - } - -} - http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/28dcba96/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/handler/hrd/ClientIdHomeRealmDiscovery.java ---------------------------------------------------------------------- diff --git a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/handler/hrd/ClientIdHomeRealmDiscovery.java b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/handler/hrd/ClientIdHomeRealmDiscovery.java index 5fc186f..6ff1151 100644 --- a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/handler/hrd/ClientIdHomeRealmDiscovery.java +++ b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/handler/hrd/ClientIdHomeRealmDiscovery.java @@ -27,7 +27,6 @@ import javax.security.auth.callback.UnsupportedCallbackException; import javax.servlet.http.HttpServletRequest; import org.apache.cxf.fediz.core.spi.HomeRealmCallback; -import org.apache.cxf.fediz.service.oidc.FedizClient; import org.apache.cxf.fediz.service.oidc.OAuthDataManager; import org.apache.cxf.rs.security.oauth2.common.Client; import org.slf4j.Logger; @@ -51,10 +50,9 @@ public class ClientIdHomeRealmDiscovery implements CallbackHandler { OAuthDataManager dataManager = (OAuthDataManager)ctx.getBean("oauthProvider"); Client client = dataManager.getClient(clientId); - if (client instanceof FedizClient) { - callback.setHomeRealm(((FedizClient)client).getHomeRealm()); - LOG.debug("Retrieved home realm {}", callback.getHomeRealm()); - } + callback.setHomeRealm(client.getHomeRealm()); + LOG.debug("Retrieved home realm {}", callback.getHomeRealm()); + } } else {
