1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
26 package com.sun.tools.internal.ws.wscompile; |
26 package com.sun.tools.internal.ws.wscompile; |
27 |
27 |
28 import com.sun.istack.internal.NotNull; |
28 import com.sun.istack.internal.NotNull; |
29 |
29 |
30 import java.net.URL; |
30 import java.net.URL; |
|
31 import java.util.regex.Pattern; |
31 |
32 |
32 /** |
33 /** |
33 * Represents authorization information needed by {@link com.sun.tools.internal.ws.wscompile.DefaultAuthenticator} to |
34 * Represents authorization information needed by {@link com.sun.tools.internal.ws.wscompile.DefaultAuthenticator} to |
34 * authenticate wsimport to access the wsdl. |
35 * authenticate wsimport to access the wsdl. |
35 * |
36 * |
37 */ |
38 */ |
38 |
39 |
39 public final class AuthInfo { |
40 public final class AuthInfo { |
40 private final String user; |
41 private final String user; |
41 private final String password; |
42 private final String password; |
42 private final URL url; |
43 private final Pattern urlPattern; |
43 |
44 |
44 public AuthInfo(@NotNull URL url, @NotNull String user, @NotNull String password){ |
45 public AuthInfo(@NotNull URL url, @NotNull String user, @NotNull String password) { |
45 this.url = url; |
46 String u = url.toExternalForm().replaceFirst("\\?", "\\\\?"); |
|
47 this.urlPattern = Pattern.compile(u.replace("*", ".*"), Pattern.CASE_INSENSITIVE); |
46 this.user = user; |
48 this.user = user; |
47 this.password = password; |
49 this.password = password; |
48 } |
50 } |
49 |
51 |
50 public String getUser() { |
52 public String getUser() { |