1/*2 * Copyright 2001-2009 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * http://www.apache.org/licenses/LICENSE-2.08 * 9 * Unless required by applicable law or agreed to in writing, software10 * distributed under the License is distributed on an "AS IS" BASIS,11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12 * See the License for the specific language governing permissions and13 * limitations under the License.14 */15package org.apache.juddi.v3.tck;
1617import java.rmi.RemoteException;
18import javax.xml.ws.BindingProvider;
1920import org.uddi.v3_service.DispositionReportFaultMessage;
21import org.uddi.v3_service.UDDISecurityPortType;
22/**23 * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>24 * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>25 */26publicclassTckSecurity {
2728publicstatic String getAuthToken(UDDISecurityPortType securityService, String pubId, String cred) throws DispositionReportFaultMessage, RemoteException {
2930if (!TckPublisher.isUDDIAuthMode())
31returnnull;
32 org.uddi.api_v3.GetAuthToken ga = new org.uddi.api_v3.GetAuthToken();
33 ga.setUserID(pubId);
34 ga.setCred(cred);
3536 org.uddi.api_v3.AuthToken token = securityService.getAuthToken(ga);
3738return token.getAuthInfo();
39 }
4041/**42 * used for non UDDI AuthToken authentication. I.e. HTTP NTLM, HTTP BASIC, HTTP DIGEST43 * @param bindingProvider44 * @param publisherId45 * @param password 46 */47publicstaticvoid setCredentials(BindingProvider bindingProvider, String publisherId, String password) {
48 bindingProvider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, publisherId);
49 bindingProvider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
50 }
5152 }