1

Liferay 6.1を使用していますが、デフォルトのLiferayログイン認証を上書きし、カスタム認証を設定したいと考えています。

これまで私が行ったことは、フックプラグインを作成し、portal.propertiesファイルに次のプロパティを設定したことです。

auth.pipeline.pre=com.liferay.portal.security.auth.MyCustomAuthenticator
auth.pipeline.enable.liferay.check=false

ここで、MyCustomAuthenticatorは、(Authenticatorを実装する)カスタムオーセンティケータークラスです。

現在、Liferayはこのカスタム認証を最初にチェックしますが、その後もLiferay自体に送られ、さらにLiferay認証が行われます。

このLiferay検証を上書きしたいと思います。この問題の解決にご協力ください。これが私のオーセンティケータークラスです:

public class MyCustomAuthenticator implements Authenticator {  

  public int authenticateByEmailAddress(long arg0, String arg1, String arg2, Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {  

    System.out.println("succeeded by mail");  
    return SUCCESS;  
  }  

 public int authenticateByScreenName(long arg0, String arg1, String arg2, Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {  

    System.out.println("succeeded by screen name");  
    return SUCCESS;  
  }  

 public int authenticateByUserId(long arg0, long arg1, String arg2, Map<String, String[]> arg3, Map<String, String[]> arg4) throws AuthException {  

    System.out.println("succeeded by user id");  
    return SUCCESS;  
  }  

}  
4

3 に答える 3

4

portal-ext.properties に次のプロパティを追加し、サーバーを再起動します。

auth.pipeline.enable.liferay.check=false
于 2012-05-18T08:22:06.673 に答える
0

私は同じ方法でフックを作成しました。フックの portal.properties オーバーライドに次の 2 行を追加し、さらに適切な手段として portal-ext.properties に次の 2 行を追加しました。

auth.pipeline.pre=com.liferay.portal.security.auth.MyCustomAuthenticator
auth.pipeline.enable.liferay.check=false

ただし、アカウントが既に存在する場合でも、Liferay にログインしたくないようです。完全に機能するようになり、Liferay 認証を完全にスキップすることができました。portal.properties をオーバーライドするフックだけで十分です。portal-ext から 2 行を削除しました。カスタム認証では、SUCCESS を返すだけでなく、(com.liferay.portal.security.auth.Authenticator.SUCCESS)

SKIP_LIFERAY_CHECK を返したい。これは、認証パイプラインが liferay チェックをスキップすることを認識していることを除いて、SUCCESS と同じです。

これにより、強制的に機能するはずです。ソース コード (Liferay 6.2 ga5 用) では、「Skip Liferay Check」プロパティが適切に考慮されておらず、これが本質的に強制されていると思います。

于 2016-07-06T14:08:58.257 に答える