Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Boris Kamenov 3 posts 83 karma points
    Aug 18, 2022 @ 14:45
    Boris Kamenov
    0

    No access to the protected media item - even though the user is within the correct Member Group

    Hello, we recently purchased a license for the Media Protect product.

    However, when testing it both on our Production and at localhost, the logged user within the correct Member Group is not able to access the protected media file.

    Here is my setup: Umbraco 8.17.1 MediaProtect 2.8.4

    1. I have a protected folder with a media file within it - /media/lhrpougl/pdfsample.pdf enter image description here
    2. It is protected based on the member group – Standard members should be able to access it. enter image description here
    3. I log in the site with a user that is a member of the Standard group. enter image description here
    4. When I try to access the file - I am redirected to the login page enter image description here

    I created a sample macro to showcase the issue - it shows that it recognizes that the user is logged in has the correct group and according to the method MediaHasAccess() should be able to access the file, but still when I click on the link I get redirected to the login page:

    @using MediaProtect.Library.TypeExtensions
    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @{
        var mediaPath = "/media/lhrpougl/pdfsample.pdf";
    }
    <div>
        <div>Is logged in: @Members.GetCurrentLoginStatus().IsLoggedIn</div>
        <div>Email: @Members.GetCurrentLoginStatus().Email</div>
        <div>Username: @Members.GetCurrentLoginStatus().Username</div>
        <div>
            User roles :
            @foreach (var role in Roles.GetRolesForUser(Members.GetCurrentLoginStatus().Username))
            {
                <span>@role</span>
                <br />
            }
        </div>
        <div>Has access to <a target="_blank" href="@mediaPath">@mediaPath</a>: @Umbraco.MediaHasAccess(mediaPath)</div>
    </div>
    </div>
    

    The result is : Macro result

    Additional note: for login we integrate with Azure AD.

    I would love to get some pointers on how to fix it or if there is something I am missing.

    Regards, Boris.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Aug 19, 2022 @ 06:38
    Richard Soeteman
    0

    Hi Boris,

    The current implementation of the authentication provider media protect uses was strict for Umbraco Membership. I've checked the source of Umbraco and the membershiphelper in your sample uses the standard asp.net membership provider So i think that changing the authenticationprovider in mediaprotect.config to MemberShipAuthentication should do the trick. If not please let me know.

    Best,

    Richard

  • Boris Kamenov 3 posts 83 karma points
    Aug 19, 2022 @ 07:45
    Boris Kamenov
    0

    Hey Richard,

    Thanks for the quick answer. Unfortunately the result is still the same.

    I changed the authenticationprovider in mediaprotect.config to MemberShipAuthentication as you suggested - enter image description here But it still redirects to the login page.

    Best, Boris

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Aug 19, 2022 @ 08:37
    Richard Soeteman
    100

    Could be that my middleware is to early in the process. Haven't tested this on Azure AD but a mediaprotect provider is easy to implement. If you contact [email protected] I send you a sample.

    Best,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft