001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008 Sun Microsystems, Inc. 015 * Portions Copyright 2015 ForgeRock AS. 016 */ 017 018package org.opends.server.authorization.dseecompat; 019 020/** 021 * This class provides an enumeration of the allowed bind rule 022 * keyword types. 023 */ 024public enum EnumBindRuleKeyword { 025 026 /** 027 * The enumeration type when the bind rule has specified keyword of 028 * userdn. 029 */ 030 USERDN ("userdn"), 031 /** 032 * The enumeration type when the bind rule has specified keyword of 033 * groupdn. 034 */ 035 GROUPDN ("groupdn"), 036 /** 037 * The enumeration type when the bind rule has specified keyword of 038 * roledn. 039 */ 040 ROLEDN ("roledn"), 041 /** 042 * The enumeration type when the bind rule has specified keyword of 043 * ip. 044 */ 045 IP ("ip"), 046 /** 047 * The enumeration type when the bind rule has specified keyword of 048 * dns. 049 */ 050 DNS ("dns"), 051 /** 052 * The enumeration type when the bind rule has specified keyword of 053 * dayofweek. 054 */ 055 DAYOFWEEK ("dayofweek"), 056 /** 057 * The enumeration type when the bind rule has specified keyword of 058 * timeofday. 059 */ 060 TIMEOFDAY ("timeofday"), 061 /** 062 * The enumeration type when the bind rule has specified keyword of 063 * userattr. 064 */ 065 USERATTR ("userattr"), 066 /** 067 * The enumeration type when the bind rule has specified keyword of 068 * authmethod. 069 */ 070 AUTHMETHOD ("authmethod"), 071 /** The enumeration type when the bind rule has specified keyword of ssf. */ 072 SSF("ssf"); 073 074 /** The keyword name. */ 075 private final String keyword; 076 077 /** 078 * Creates a new enumeration type for the specified keyword. 079 * @param keyword The keyword name. 080 */ 081 EnumBindRuleKeyword(String keyword){ 082 this.keyword = keyword; 083 } 084 085 /** 086 * Checks to see if the keyword string is equal to the enumeration. 087 * @param keywordStr The keyword name to check equality for. 088 * @return True if the keyword is equal to the specified name. 089 */ 090 public boolean isBindRuleKeyword(String keywordStr){ 091 return keywordStr.equalsIgnoreCase(this.keyword); 092 } 093 094 /** 095 * Create a new enumeration type for the specified keyword name. 096 * @param keywordStr The name of the enumeration to create. 097 * @return A new enumeration type for the name or null if the name is 098 * not valid. 099 */ 100 public static EnumBindRuleKeyword createBindRuleKeyword(String keywordStr){ 101 if (keywordStr != null){ 102 for (EnumBindRuleKeyword t : EnumBindRuleKeyword.values()){ 103 if (t.isBindRuleKeyword(keywordStr)){ 104 return t; 105 } 106 } 107 } 108 return null; 109 } 110}