gnu.javax.security.auth.login
Class ConfigFileParser
A parser that knows how to interpret JAAS Login Module Configuration files
written in the
default syntax which is interpreted as adhering to
the following grammar:
CONFIG ::= APP_OR_OTHER_ENTRY+
APP_OR_OTHER_ENTRY ::= APP_NAME_OR_OTHER JAAS_CONFIG_BLOCK
APP_NAME_OR_OTHER ::= APP_NAME
| 'other'
JAAS_CONFIG_BLOCK ::= '{' (LOGIN_MODULE_ENTRY ';')+ '}' ';'
LOGIN_MODULE_ENTRY ::= MODULE_CLASS FLAG MODULE_OPTION* ';'
FLAG ::= 'required'
| 'requisite'
| 'sufficient'
| 'optional'
MODULE_OPTION ::= PARAM_NAME '=' PARAM_VALUE
APP_NAME ::= JAVA_IDENTIFIER
MODULE_CLASS ::= JAVA_IDENTIFIER ('.' JAVA_IDENTIFIER)*
PARAM_NAME ::= STRING
PARAM_VALUE ::= '"' STRING '"' | ''' STRING ''' | STRING
This parser handles UTF-8 entities when used as APP_NAME and PARAM_VALUE.
It also checks for the use of Java identifiers used in MODULE_CLASS, thus
minimizing the risks of having
ClassCastException
s thrown
at runtime due to syntactically invalid names.
In the above context, a JAVA_IDENTIFIER is a sequence of tokens,
separated by the character '.'. Each of these tokens obeys the following:
- its first character yields
true
when used as an input to
the Character.isJavaIdentifierStart(char)
, and - all remaining characters, yield
true
when used as an
input to Character.isJavaIdentifierPart(char)
.
Map<K,V> | getLoginModulesMap() - Returns the parse result as a
Map where the keys are application
names, and the entries are List s of AppConfigurationEntry
entries, one for each login module entry, in the order they were
encountered, for that application name in the just parsed configuration
file.
|
void | parse(Reader r) - Parses the
Reader 's contents assuming it is in the default
syntax.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
getLoginModulesMap
public Map<K,V> getLoginModulesMap()
Returns the parse result as a
Map
where the keys are application
names, and the entries are
List
s of
AppConfigurationEntry
entries, one for each login module entry, in the order they were
encountered, for that application name in the just parsed configuration
file.
parse
public void parse(Reader r)
throws IOException
Parses the
Reader
's contents assuming it is in the
default
syntax.
r
- the Reader
whose contents are assumed to be a JAAS Login
Configuration Module file written in the default syntax.
IOException
- if an exception occurs while parsing the input.
ConfigFileParser.java -- JAAS Login Configuration default syntax parser
Copyright (C) 2006, 2010 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.