Weblogic扩展JAAS身份验证案例
步骤一、首先通过MDF的XML文件定义验证提供程序,文件路径为:d:\src\ImepAuthenticator.xml
<?xml version="1.0" ?><!DOCTYPE MBeanType SYSTEM "commo.dtd"><!-- MBean Definition File (MDF) for the Sample Authenticator. Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.--><!-- Declare your mbean. Since it is for an authenticator, it must extend the weblogic.management.security.authentication.Authenticator mbean. The Name and DisplayName must be the same. They specify the name that will appear on the console for this provider. Set the PeristPolicy to "OnUpdate" so that if an attribute value is changed, the new value is written to disk immediately. See the "Developing Security Services" manual for more info. Note that since this is an xml document, you can't use double quotes directly. Instead you need to use " Note that setting "Writeable" to "false" on an attribute makes the attribute read-only. The default is read-write.--><MBeanTypeName = "ImepSecurityAuthenticator"DisplayName = "Imep Security Authenticator"Package = "com.imep.security"Extends = "weblogic.management.security.authentication.Authenticator"PersistPolicy = "OnUpdate"><!-- You must set the value of the ProviderClassName attribute (inherited from the weblogic.management.security.Provider mbean) to the name of the java class you wrote that implements the weblogic.security.spi.AuthenticationProvider interface. You can think of the provider's mbean as the factory for your provider's runtime implementation.--><MBeanAttribute Name = "roviderClassName" Type = "java.lang.String" Writeable = "false" Default = ""com.imep.security.ImepAuthProviderImpl""/><!-- You must set the value of the Description attribute (inherited from the weblogic.management.security.Provider mbean) to a brief description of your provider. It is displayed in the console.--><MBeanAttribute Name = "Description" Type = "java.lang.String" Writeable = "false" Default = ""Authenticator used for the MedRec sample application only""/><!-- You must set the value of the Version attribute (inherited from the weblogic.management.security.Provider mbean) to your provider's version. There is no required format.--><MBeanAttribute Name = "Version" Type = "java.lang.String" Writeable = "false" Default = ""1.0""/><!-- Add any custom attributes for your provider here. The sample authenticator does not have any custom attributes. Note: custom attributes do not appear in the console in WLS 7.0. Use the admin command line tool (java weblogic.Admin) to view and set their values. Refer to the "Developing Security Services" manual for more info on defining custom attributes.--></MBeanType>
private AppConfigurationEntry getConfiguration(HashMap hashmap) { hashmap.put("database", new ImepAuthDatabase()); return new AppConfigurationEntry("com.imep.security.ImepLoginModuleImpl", controlFlag, hashmap); }