public AuthScope getScope()

in wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/BasicAuthScope.java [81:135]


    public AuthScope getScope( String host, int port )
    {
        if ( getHost() != null //
            && "ANY".compareTo( getHost() ) == 0 //
            && getPort() != null //
            && "ANY".compareTo( getPort() ) == 0 //
            && getRealm() != null //
            && "ANY".compareTo( getRealm() ) == 0 )
        {
            return AuthScope.ANY;
        }
        String scopeHost = host;
        if ( getHost() != null )
        {
            if ( "ANY".compareTo( getHost() ) == 0 )
            {
                scopeHost = AuthScope.ANY_HOST;
            }
            else
            {
                scopeHost = getHost();
            }
        }

        int scopePort = port > -1 ? port : AuthScope.ANY_PORT;
        // -1 for server/port settings does this, but providing an override here
        // in
        // the BasicAuthScope config
        if ( getPort() != null )
        {
            if ( "ANY".compareTo( getPort() ) == 0 )
            {
                scopePort = AuthScope.ANY_PORT;
            }
            else
            {
                scopePort = Integer.parseInt( getPort() );
            }
        }

        String scopeRealm = AuthScope.ANY_REALM;
        if ( getRealm() != null )
        {
            if ( "ANY".compareTo( getRealm() ) != 0 )
            {
                scopeRealm = getRealm();
            }
            else
            {
                scopeRealm = getRealm();
            }
        }

        return new AuthScope( scopeHost, scopePort, scopeRealm );
    }