src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/AuthInfo.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
     1.1 --- a/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/AuthInfo.java	Thu Apr 04 19:05:24 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/AuthInfo.java	Tue Apr 09 14:51:13 2013 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -28,6 +28,7 @@
    1.11  import com.sun.istack.internal.NotNull;
    1.12  
    1.13  import java.net.URL;
    1.14 +import java.util.regex.Pattern;
    1.15  
    1.16  /**
    1.17   * Represents authorization information needed by {@link com.sun.tools.internal.ws.wscompile.DefaultAuthenticator} to
    1.18 @@ -39,10 +40,11 @@
    1.19  public final class AuthInfo {
    1.20      private final String user;
    1.21      private final String password;
    1.22 -    private final URL url;
    1.23 +    private final Pattern urlPattern;
    1.24  
    1.25 -    public AuthInfo(@NotNull URL url, @NotNull String user, @NotNull String password){
    1.26 -        this.url = url;
    1.27 +    public AuthInfo(@NotNull URL url, @NotNull String user, @NotNull String password) {
    1.28 +        String u = url.toExternalForm().replaceFirst("\\?", "\\\\?");
    1.29 +        this.urlPattern = Pattern.compile(u.replace("*", ".*"), Pattern.CASE_INSENSITIVE);
    1.30          this.user = user;
    1.31          this.password = password;
    1.32      }
    1.33 @@ -59,7 +61,7 @@
    1.34       * Returns if the requesting host and port are associated with this {@link AuthInfo}
    1.35       */
    1.36      public boolean matchingHost(@NotNull URL requestingURL) {
    1.37 -        return requestingURL.equals(url);
    1.38 +        return urlPattern.matcher(requestingURL.toExternalForm()).matches();
    1.39      }
    1.40  
    1.41  }

mercurial