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.v2.tck;
1617import java.rmi.RemoteException;
18import javax.xml.ws.BindingProvider;
1920import org.uddi.v2_service.DispositionReport;
21import org.uddi.v2_service.Publish;
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 * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>26 */27publicclassTckSecurity {
2829publicstatic String getAuthToken(Publish securityService, String pubId, String cred) throws DispositionReport, RemoteException {
3031if (!TckPublisher.isUDDIAuthMode())
32returnnull;
33 org.uddi.api_v2.GetAuthToken ga = new org.uddi.api_v2.GetAuthToken();
34 ga.setGeneric("2.0");
35 ga.setUserID(pubId);
36 ga.setCred(cred);
3738 org.uddi.api_v2.AuthToken token = securityService.getAuthToken(ga);
3940return token.getAuthInfo();
41 }
4243/**44 * used for non UDDI AuthToken authentication. I.e. HTTP NTLM, HTTP BASIC, HTTP DIGEST45 * @param bindingProvider46 * @param publisherId47 * @param password 48 */49publicstaticvoid setCredentials(BindingProvider bindingProvider, String publisherId, String password) {
50 bindingProvider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, publisherId);
51 bindingProvider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
52 }
5354 }