legacy-knowledge-base
公開されました Jul. 2, 2025

JSONWSゲストアクセス

written-by

Christopher Lui

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

Liferay プラットフォームの JSONWS ページは、未認証のユーザーでも Liferay_URL/api/jsonwsで利用可能です。 しかし、これはゲストユーザーがJSONウェブサービスを実行できることを意味するものではありません。 Guestとしてアクセスすると,JSONWS ページに Web サービスが表示されていても,ほとんどの Web サービスは呼び出すことができません. 例えば、ゲストが /announcementsdelivery/update-deliveryを使用する場合、 Guestとしてメソッドを起動すると、以下のエラーが表示されます。

Access denied to com.liferay.announcements.kernel.service.AnnouncementsDeliveryService#updateDelivery

これは、基盤となるサービスが、サービスの種類と目的に応じて Liferay の権限フレームワークによって保護されているからです。例えば、上記の updateDelivery サービスコールを実行するには、ユーザーはユーザーエンティティに対して ADD USER と UPDATE 権限を持っている必要があります。

認証されていないサービスコールは、Liferayプラットフォームインスタンスまたはあなたのプラグインのリモートメソッドが @AccessControlled アノテーションを持つ場合にのみ動作します。 Guestとして呼び出せるサービスが少量あります。例えば、 /country/get-countriesなどです。 これは、次のコードの @AccessControlled(guestAccessEnabled = true) アノテーションによって、その特定のメソッドにゲストからアクセスできるようになるためです。

Line 103 in CountryServiceImpl.java

    @AccessControlled(guestAccessEnabled = true)
    @Override
    public List<Country> getCountries(boolean active) {
        return countryPersistence.findByActive(active);
    }

DXP 7.0 SP7/FP57 および DXP 7.1+ の時点で Guest からアクセス可能なその他のリモートサービスは以下のとおりです。

/assetentry/increment-view-counter

/calendar.calendarbooking/search
/calendar.calendarbooking/searchCount /country/get-countries
/country/get-company-countries [7.4 only]
/pushnotifications.pushnotificationsdevice/add-push-notifications-device /pushnotifications.pushnotificationsdevice/delete-push-notifications-device /region/get-regions /sync.syncdlobject/get-sync-context

APIサービスは、コンパイル時に @AccessControlAdvice アノテーションを使用して、公開するように設定することができます。 この はランタイム設定を許可しておらず、ポータル管理者は 認証なしでサービスを利用できるようにするために ポータルを再コンパイルする必要があることに注意してください。

また、portal-ext.propertiesファイルで、以下のportalプロパティを false、JSON APIページを完全に無効にすることが可能です。

    #
    # Set this property to true if JSON web services are discoverable through
    # the API page.
    #
    jsonws.web.service.api.discoverable=true
did-this-article-resolve-your-issue

legacy-knowledge-base