2

Adobe を使用しようとしてDigital Publishing Suite Web Viewer. います Web Viewer を正しくセットアップしました - 私の Web サイト内で動作しています。ただし、Web Viewer がアクセスしている Folio に各ユーザーがアクセスできることを認証するわけではありません。Adobe には、これを行う方法に関する一種のドキュメントがありますが、ドキュメントが不足しているようです。Adobe がユーザーのユーザー名とパスワードを Adob​​e に取得するように求めているようですが、それは正しくありません。Adobe がフィッシングを誘うとは思えません。しかし、私が迷っているのはそれだけではありません。

私の現在のスクリプトは次のとおりです。

    var wvQueryParamGroups = location.search.match(/[?&^#]wv=(s[\/%\-.\w]+)/),
    wvQueryParam = wvQueryParamGroups && wvQueryParamGroups.length === 2 ? decodeURIComponent(wvQueryParamGroups[1]) : null;

    function loadXMLDoc(url, successCallback, failCallback) {
        if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        }
        else {// code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                var parser = new DOMParser();
                var xmlDoc = parser.parseFromString(xmlhttp.responseText, "application/xml");
                successCallback(xmlDoc);
            } else if (xmlhttp.readyState == 4 && xmlhttp.status == 0) {
                alert("unsuccessful cross-domain data access attempt?");
                failCallback(xmlhttp.status);
            } else if (xmlhttp.readyState == 4) {
                failCallback(xmlhttp.status);
            } else {
                console.log('readystate=' + xmlhttp.readyState + ', status=' + xmlhttp.status);
            }
        }
        xmlhttp.open("GET", url, true);
        xmlhttp.send();
    }

    function directEntitlementSignIn(directEntitlementURL, emailAddress, password, appID, authTokenSuccess, authTokenFail) {
        var response;
        if (!authTokenSuccess || !authTokenFail) {
            throw new Error('Callbacks are required: ');
        }
        loadXMLDoc(directEntitlementURL + '?emailAddress=' + emailAddress + '&password=' + password + '&appId=' + appID,
        handleToken = function (data) {
            token = data.documentElement.childNodes[0].innerHTML;
            authTokenSuccess(token);
        }
        );
    }

    function onAuthTokenSuccess(token) {
        alert(token);
        // pass the token into the Authenticator class's login method
    }

    function onAuthTokenFail(status) {
        alert("fail: " + status);
        // prompt the user to try logging in again
    }

    function signIn(emailAddress, password) {
        var deAPIURL = 'http://127.0.0.1/hostDemos r27/authHard/test.php';
        var emailAddress; // user's login ID.....get from form
        var password; // user's password ... get from form
        var appID = 'com.publisher.magazine';

        directEntitlementSignIn(deAPIURL, emailAddress, password, appID, onAuthTokenSuccess, onAuthTokenFail);
    }

    function eventCallback(ev) {
        if (ev.eventType == "paywall") {
            return false;
        }
        if (ev.eventType == "metadata") {
            return true;
        }
        console.log(ev);
        return true;
    }

    function errorCallback (message) {
        console.log(message);
        return true;
    }

    function redirectCallbackHandler (message) {
        console.log(message);
    }

    var wv_appName = "Professional Roofing";
    var wv_accountID = Account_ID_Is_Here; //Hiding account ID purposely
    var wv_folio = "August 2014 Issue";
    var wv_article = "Cover";
    var wv_url = '/s/' + wv_appName + '/' + wv_accountID + '/' + wv_folio + '/' + wv_article + '.html';
    console.log(wv_url);

    var bridge = adobeDPS.frameService.createFrame({
        boolIsFullScreen : true,
        parentDiv : 'mainContainer',
        wrapperClasses : 'uniqueFrame',
        iframeID : 'demoFrame',
        accountIDs : wv_accountID,
        wvParam : wvQueryParam ? wvQueryParam : wv_url,
        curtainClasses : 'mask hidden',
        eventCallback : eventCallback,
        errorCallback : errorCallback,
        redirectCallback : redirectCallbackHandler
    });
4

1 に答える 1

1

アドビはユーザー名とパスワードを必要としません。認証トークンが必要です。それを機能させるには、次のものが必要です。

  • Direct Entitlements API を実装する
  • アドビのアカウント担当者にインテグレーター ID の作成を依頼してください

その後、オーセンティケーターを作成する必要があります。

  auth = adobeDPS.authenticationService.createAuthenticator(strAccountID, strIntegratorID);

そしてそれにauthTokenを渡します

 auth.login(token, successCalck, errorCallback)
于 2014-08-18T17:31:17.303 に答える