Class XmlFileAuthorizationCallback

All Implemented Interfaces:
IConfigurable, AuthorizationCallback

public class XmlFileAuthorizationCallback
extends DefaultAuthorizationCallback
Implements authorization information retrieval from a XML file.

Configuration:

 <AuthorizationCallback class="rs.baselib.security.XmlFileAuthorizationCallback">
 
    <!-- The XML file name. -->
    <File>/path/to/file.xml</File>
    
 </AuthorizationCallback>
 

The XML file itself shall look like this:

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <authorization>
        <login>your-login</login>
        <password>your-password</password>
 </authorization>
 
Author:
Ralph Schuster
  • Constructor Summary

    Constructors 
    Constructor Description
    XmlFileAuthorizationCallback()
    Default Constructor.
  • Method Summary

    Modifier and Type Method Description
    void configure​(java.io.File file)
    Configures the callback from the XML file.
    void configure​(java.lang.String file)
    Configures the callback from the XML file.
    void configure​(org.apache.commons.configuration.Configuration config)
    Configures the callback.

    Methods inherited from class rs.baselib.security.AbstractAuthorizationCallback

    getName, getPassword, setName, setPassword

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • configure

      public void configure​(org.apache.commons.configuration.Configuration config) throws org.apache.commons.configuration.ConfigurationException
      Configures the callback. Configuration takes place from a XML file whose path is contained within element <File>. The XML file itself must contain two elements <login> and <password>.
      Specified by:
      configure in interface IConfigurable
      Overrides:
      configure in class DefaultAuthorizationCallback
      Parameters:
      config - - configuration object
      Throws:
      org.apache.commons.configuration.ConfigurationException - - when configuration fails
    • configure

      public void configure​(java.lang.String file) throws org.apache.commons.configuration.ConfigurationException
      Configures the callback from the XML file.
      Parameters:
      file - filename
      Throws:
      org.apache.commons.configuration.ConfigurationException - when object cannot be configured from file
    • configure

      public void configure​(java.io.File file) throws org.apache.commons.configuration.ConfigurationException
      Configures the callback from the XML file.
      Parameters:
      file - file
      Throws:
      org.apache.commons.configuration.ConfigurationException - when object cannot be configured from file