jdk/src/share/classes/com/sun/security/sasl/util/PolicyUtils.java
changeset 10336 0bb1999251f8
parent 5506 202f599c92aa
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2011, 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
    51      * fits the security policy properties found in props.
    51      * fits the security policy properties found in props.
    52      * @param flags The mechanism's security characteristics
    52      * @param flags The mechanism's security characteristics
    53      * @param props The security policy properties to check
    53      * @param props The security policy properties to check
    54      * @return true if passes; false if fails
    54      * @return true if passes; false if fails
    55      */
    55      */
    56     public static boolean checkPolicy(int flags, Map props) {
    56     public static boolean checkPolicy(int flags, Map<String, ?> props) {
    57         if (props == null) {
    57         if (props == null) {
    58             return true;
    58             return true;
    59         }
    59         }
    60 
    60 
    61         if ("true".equalsIgnoreCase((String)props.get(Sasl.POLICY_NOPLAINTEXT))
    61         if ("true".equalsIgnoreCase((String)props.get(Sasl.POLICY_NOPLAINTEXT))
    91      * subset that conforms to the policies defined in props.
    91      * subset that conforms to the policies defined in props.
    92      * Useful for SaslXXXFactory.getMechanismNames(props) implementations.
    92      * Useful for SaslXXXFactory.getMechanismNames(props) implementations.
    93      *
    93      *
    94      */
    94      */
    95     public static String[] filterMechs(String[] mechs, int[] policies,
    95     public static String[] filterMechs(String[] mechs, int[] policies,
    96         Map props) {
    96         Map<String, ?> props) {
    97         if (props == null) {
    97         if (props == null) {
    98             return mechs.clone();
    98             return mechs.clone();
    99         }
    99         }
   100 
   100 
   101         boolean[] passed = new boolean[mechs.length];
   101         boolean[] passed = new boolean[mechs.length];