身份验证提供程序:WL 12.1.3.0.0

时间:2015-11-17 13:56:59

标签: java security authentication weblogic12c

我刚刚为WebLogic Server版本12.1.3.0.0创建了一个身份验证提供程序,(身份验证提供程序通过在许多可配置的JAAS LoginModule之上构建身份验证序列来遵守标准JAAS框架。)但是当我开始Wl时,我有这个错误:

这里的步骤:

1)设置ENV

%WL_HOME%/server/bin/setWLSEnv.cmd

2)生成MBean和stubs:

java -cp %WL_HOME%/server/lib/* -verbose -DcreateStubs="true" \
weblogic.management.commo.WebLogicMBeanMaker -MDF WSAuthentication.xml \
-files C:\Development\Workspaces\Eclipse\WLAuthenticationProvider\src

3)使用生成的存根和MBI文件打包身份验证提供程序和登录模块。

java -DMJF=C:\Development\Workspaces\Eclipse\WLAuthenticationProvider\jar\WSAuthentication.jar \
-Dfiles=C:\Development\Workspaces\Eclipse\WLAuthenticationProvider\src weblogic.management.commo.WebLogicMBeanMaker

4)在startWebLogic.cmd中添加-DUseSunHttpHandler = true

weblogic.security.service.SecurityServiceRuntimeException: [Security:090877]Service Common JAASAuthenticationService unavailable, see exception text: com.bea.common.engine.ServiceInitializationException: com.bea.common.engine.SecurityServiceRuntimeException: [Security:097533]SecurityProvider service class name for MyAuthentication is not specified.
        at weblogic.security.service.PrincipalAuthenticator.initialize(PrincipalAuthenticator.java:155)
        at weblogic.security.service.PrincipalAuthenticator.<init>(PrincipalAuthenticator.java:315)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doATN(CommonSecurityServiceManagerDelegateImpl.java:731)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.postInitializeRealm(CommonSecurityServiceManagerDelegateImpl.java:515)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.postLoadRealm(CommonSecurityServiceManagerDelegateImpl.java:861)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.postInitializeRealms(CommonSecurityServiceManagerDelegateImpl.java:927)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.postInitialize(CommonSecurityServiceManagerDelegateImpl.java:1109)
        at weblogic.security.service.SecurityServiceManager.postInitialize(SecurityServiceManager.java:943)
        at weblogic.security.SecurityService.start(SecurityService.java:159)
        at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78)
        at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017)
        at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
        at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
        at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
        at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
        at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
        at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
        at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
        at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231)
        at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254)
        at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413)
        at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
        at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225)
        at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82)
        at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
        at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
        at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:553)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused by: com.bea.common.engine.ServiceInitializationException: com.bea.common.engine.SecurityServiceRuntimeException: [Security:097533]SecurityProvider service class name for TntWS2Authentication is not specified.
        at com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:365)
        at com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:315)
        at com.bea.common.engine.internal.ServiceEngineImpl.lookupService(ServiceEngineImpl.java:257)
        at com.bea.common.engine.internal.ServicesImpl.getService(ServicesImpl.java:72)
        at weblogic.security.service.CSSWLSDelegateImpl.getService(CSSWLSDelegateImpl.java:155)
        at com.bea.security.css.CSS.getService(CSS.java:123)
        at weblogic.security.service.PrincipalAuthenticator.initialize(PrincipalAuthenticator.java:132)
        ... 46 more
Caused by: com.bea.common.engine.SecurityServiceRuntimeException: [Security:097533]SecurityProvider service class name for MyAuthentication is not specified.
        at com.bea.common.security.internal.legacy.service.SecurityProviderImpl.init(SecurityProviderImpl.java:42)
        at com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:363)
        ... 52 more

这里是我的文件MyAuthentication.xml(用于身份验证提供程序的简单MDF(MyAuthentication.xml))。 WebLogic的提供程序体系结构是基于MBean的

<?xml version="1.0" ?>
<!DOCTYPE MBeanType SYSTEM "commo.dtd">
<MbeanType 
        Name = "MyAuthentication" 
        DisplayName = "MyAuthentication"
        Package = "fr.telecom.devices.ws.security.iap"
        Extends = "weblogic.management.security.authentication.Authenticator"
        PersistPolicy = "OnUpdate"  >

<MbeanAttribute 
        Name = "ProviderClassName" 
        Type = "java.lang.String"
        Writeable = "false"
        Default ="&quot;fr.telecom.devices.ws.security.iap.MyAuthenticationProviderImpl&quot;"
      />

    <MbeanAttribute Name = "Description" Type = "java.lang.String"
      Writeable = "false"
      Default = "&quot;Traces Authentication Provider&quot;"
      />

    <MBeanAttribute Name = "Version" Type = "java.lang.String"
      Writeable = "false" Default = "&quot;1.0&quot;"
      />

</MbeanType>

这里是文件META-INF \ binding-file.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ns:binding-config xmlns:ns="http://www.bea.com/ns/staxb/binding-config/90">
  <ns:bindings>
    <ns:binding-type xsi:type="ns:by-name-bean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <ns:xmlcomponent>t=tnt-ws2-authenticationType@http://xmlns.oracle.com/weblogic/security/extension</ns:xmlcomponent>
      <ns:javatype>eu.cec.sanco.tracesnt.ws.security.iap.TntWS2AuthenticationMBeanImpl</ns:javatype>
      <ns:qname-property>
        <ns:xmlcomponent>t=string@http://www.w3.org/2001/XMLSchema</ns:xmlcomponent>
        <ns:javatype>java.lang.String</ns:javatype>
        <ns:getter>
          <ns:method-name>getName</ns:method-name>
        </ns:getter>
        <ns:setter>
          <ns:method-name>setName</ns:method-name>
          <ns:param-type>java.lang.String</ns:param-type>
        </ns:setter>
        <ns:issetter>
          <ns:method-name>isNameSet</ns:method-name>
        </ns:issetter>
        <ns:qname xmlns:sec="http://xmlns.oracle.com/weblogic/security">sec:name</ns:qname>
        <ns:nillable>true</ns:nillable>
      </ns:qname-property>
      <ns:qname-property>
        <ns:xmlcomponent>t=string@http://www.w3.org/2001/XMLSchema</ns:xmlcomponent>
        <ns:javatype>java.lang.String</ns:javatype>
        <ns:getter>
          <ns:method-name>getCompatibilityObjectName</ns:method-name>
        </ns:getter>
        <ns:setter>
          <ns:method-name>setCompatibilityObjectName</ns:method-name>
          <ns:param-type>java.lang.String</ns:param-type>
        </ns:setter>
        <ns:issetter>
          <ns:method-name>isCompatibilityObjectNameSet</ns:method-name>
        </ns:issetter>
        <ns:qname xmlns:sec="http://xmlns.oracle.com/weblogic/security">sec:compatibility-object-name</ns:qname>
        <ns:nillable>true</ns:nillable>
      </ns:qname-property>
      <ns:qname-property>
        <ns:xmlcomponent>t=string@http://www.w3.org/2001/XMLSchema</ns:xmlcomponent>
        <ns:javatype>java.lang.String</ns:javatype>
        <ns:getter>
          <ns:method-name>getControlFlag</ns:method-name>
        </ns:getter>
        <ns:setter>
          <ns:method-name>setControlFlag</ns:method-name>
          <ns:param-type>java.lang.String</ns:param-type>
        </ns:setter>
        <ns:issetter>
          <ns:method-name>isControlFlagSet</ns:method-name>
        </ns:issetter>
        <ns:qname xmlns:sec="http://xmlns.oracle.com/weblogic/security">sec:control-flag</ns:qname>
        <ns:nillable>true</ns:nillable>
      </ns:qname-property>
    </ns:binding-type>
    <ns:binding-type xsi:type="ns:simple-document-binding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <ns:xmlcomponent>e=tnt-ws2-authentication@http://xmlns.oracle.com/weblogic/security/extension</ns:xmlcomponent>
      <ns:javatype>eu.cec.sanco.tracesnt.ws.security.iap.TntWS2AuthenticationMBeanImpl</ns:javatype>
      <ns:type-of-element>t=tnt-ws2-authenticationType@http://xmlns.oracle.com/weblogic/security/extension</ns:type-of-element>
    </ns:binding-type>
  </ns:bindings>
  <ns:xml-to-pojo>
    <ns:mapping>
      <ns:xmlcomponent>t=tnt-ws2-authenticationType@http://xmlns.oracle.com/weblogic/security/extension</ns:xmlcomponent>
      <ns:javatype>eu.cec.sanco.tracesnt.ws.security.iap.TntWS2AuthenticationMBeanImpl</ns:javatype>
    </ns:mapping>
    <ns:mapping>
      <ns:xmlcomponent>e=tnt-ws2-authentication@http://xmlns.oracle.com/weblogic/security/extension</ns:xmlcomponent>
      <ns:javatype>eu.cec.sanco.tracesnt.ws.security.iap.TntWS2AuthenticationMBeanImpl</ns:javatype>
    </ns:mapping>
  </ns:xml-to-pojo>
  <ns:xml-to-xmlobj/>
  <ns:java-to-xml>
    <ns:mapping>
      <ns:xmlcomponent>t=tnt-ws2-authenticationType@http://xmlns.oracle.com/weblogic/security/extension</ns:xmlcomponent>
      <ns:javatype>eu.cec.sanco.tracesnt.ws.security.iap.TntWS2AuthenticationMBeanImpl</ns:javatype>
    </ns:mapping>
  </ns:java-to-xml>
  <ns:java-to-element>
    <ns:mapping>
      <ns:xmlcomponent>e=tnt-ws2-authentication@http://xmlns.oracle.com/weblogic/security/extension</ns:xmlcomponent>
      <ns:javatype>eu.cec.sanco.tracesnt.ws.security.iap.TntWS2AuthenticationMBeanImpl</ns:javatype>
    </ns:mapping>
  </ns:java-to-element>
</ns:binding-config>

这是项目的结构

enter image description here

4 个答案:

答案 0 :(得分:2)

当我要实现自定义身份验证提供程序时,我也遇到了此错误。没有非常好的教程来创建自定义身份验证提供程序。我试着和maven一起工作了。我在GitHub中找到了这个有用的教程。 Example Code can be clone here

您可以使用电子书来全面了解创建weblogic自定义身份验证提供程序。 Ebook link

您可能需要将 com.bea.core.common.security.api_1.1.0.0_6-2-0-0.jar 文件更改为此com.bea.core.common.security .api_1.1.0.0_6-2-0-0.jar

答案 1 :(得分:1)

可能有很多原因,但我想这是一个包问题。请检查生成的提供程序.jar是否包含名为META-INF/binding-file.xml的文件,并检查此文件是否具有bindind节点,如下所示:

<ns:binding-type xsi:type="ns:by-name-bean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns:xmlcomponent>t=custom-ldapdb-bean-apType@your.namespaces</ns:xmlcomponent>
    <ns:javatype>fr.telecom.devices.ws.security.iap.MyAuthenticationMBeanImpl</ns:javatype>

your.namespace必须在build.xml中定义为WebLogicMBeanMAker -target参数。

如果您的最终提供商.jar看起来像这样

,请告诉我
.
├── commo.dtd
├── MyAuthentication-Mbean.xml
├── fr
│   └── telecom
│       └── devices
│           └── ws
│               └── security
│                   └── iap
│                       ├── impl
│                       │   ├── MyAuthenticationProviderImpl.class
│                       │   ├── ...
│                       │   └── ...
│                       └── mbeans
│                           ├── MyAuthenticationImpl.class
│                           ├── MyAuthenticationMBean.class
│                           ├── MyAuthenticationImplBeanInfo.class
│                           ├── MyAuthenticationMBeanImpl.class
│                           ├── MyAuthentication$Helper.class
│                           └── MyAuthentication$SchemaHelper2.class
├── META-INF
│   ├── beaninfofactory.txt
│   ├── binding-file.ser
│   ├── binding-file.xml
│   ├── binding-mapping-file.ser
│   ├── MANIFEST.MF
│   └── schemas
│       └── schema-0.xsd
├── schemacom_bea_xml
│   ├── element
│   │   └── your_2Enamespace
│   │       └── my_2Dauthentication_2Dap.xsb
│   ├── namespace
│   │   └── your_2Enamespace
│   │       └── xmlns.xsb
│   ├── system
│   │   └── sED25F267F5545F2AED6F8F098FF3212F
│   │       ├── myauthentication94aadoctype.xsb
│   │       ├── myauthentication.xsb
│   │       ├── myauthentication7480type.xsb
│   │       ├── index.xsb
│   │       └── TypeSystemHolder.class
│   └── type
│       └── es_2Esescam_2Eprovider
│           └── my_2Dauthentication2DapType.xsb
└── weblogic
      ├── descriptor
      │   └── SettableBean.class
      └── management
          └── security
              └── LDAP_DB_WLS12C_PROVIDER18595502884856BeanInfoFactory.class

如果你遗失了什么,我想知道那是什么。

修改

我根据你的评论编辑我的答案,并回答版本。

我可以在META-INF\binding-file.xml中看到<ns:xmlcomponent>节点中没有自定义命名空间。

要在targetNamespace命令中指定WebLogicMBeanMaker,您可以按如下方式更改命令(为了清晰起见,它显示为):

java 
  -DMJF=C:\...\...\WLAuthenticationProvider\jar\WSAuthentication.jar \
  -Dfiles=C:\...\...\WLAuthenticationProvider\src \ 
  -DtargetNameSpace= your.own.namespace \
  weblogic.management.commo.WebLogicMBeanMaker

答案 2 :(得分:1)

如果您还希望与WebLogic 12.2.x兼容,则需要定义&#34; @ default&#34; Javadoc注释用于默认值,&#34; @ encrypted&#34;加密值的Javadoc注释(密码,...)

public interface LdapAuthenticatorMBean extends StandardInterface, DescriptorBean, AuthenticatorMBean {

/**
 * @default "com.mycompany.LdapAuthenticatorProviderImpl"
 */
public String getProviderClassName();

/**
 * @no-default 
 * @encrypted
 */
public String getTechPass();

并且还为每个属性定义了setter和getters方法(以前没有严格要求)。

答案 3 :(得分:1)

仔细检查提供的 MyAuthenticator.xml 中的类名

fr.telecom.devices.ws.security.iap.MyAuthenticationProviderImpl

命名空间应该是正确的