Redirect to report server from .NET after api authentication

4 posts, 0 answers
  1. Anthony
    Anthony avatar
    5 posts
    Member since:
    Aug 2016

    Posted 16 Jun 2017 Link to this post

    Hi Guys - I need to be able to log a user straight into the report server after authenticating with the api either in .NET or javascript and retrieving the token via the api (http://localhost:83/Token) instead of showing the login boxes.  

    This is a requirement because we use our own authentication mechanism in our web apps and once the user has successfully logged into our app using our authentication methods we do not want them to have to provide any further 'log in details' on the report server - Can you advise how to achieve this.  I think the steps involved may be as follows:

    1) user logs into our web app using there own credentials for our business.

    2) use the report server API to authenticate and get the token back for an admin account set up by us on report server.

    3) after successfully getting the token back, redirect the user to report server from .NET web app using a special account we set up without the requirement for them to log into report server again.

    I know there is ADFS available in Telerik report server, however our domain servers are 2003 and do not support the ADFS feature offered by report server - which is why I am looking for an alternative approach.

    Hope that makes sense, thanks for your help.:)

     

    Anthony J Brown.

  2. Stef
    Admin
    Stef avatar
    3611 posts

    Posted 19 Jun 2017 Link to this post

    Hello Anthony,

    You need to authenticate only users who are considered CALs, and who will generate reports or manage resources of the Report Server. all other users can use the guest account to request preview of published reports - Guest user.

    In case you need to give access to CALs through the Report Server API, please check: The admin user should create accounts for each CAL before they are able to log on the Report Server.

    Regards,
    Stef
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Anthony
    Anthony avatar
    5 posts
    Member since:
    Aug 2016

    Posted 19 Jun 2017 in reply to Stef Link to this post

    Hi Stef - I understand that only CAL's users have access however I need to understand how to redirect a user to the report server without being prompted with the credentials screen having already logged in and authenticated via the report server API - for example, I have a CAL user that logs into my app via Active Directory and they already have a non AD/CAL account on the report server from which they are given the bearer token - I don't want them to have to log in twice, once in my app and then again on the report server - is there a way to bypass the login screen once the user has successfully logged in via the API from a .net app and already given the access token?  Can this been achieved using HTTPContext redirect somehow?

    I seem to be presented with the report server login screen every time I login via the report server API or javascript and redirect to localhost:83.

    Look forward to your help with this one, many thanks

    Anthony J Brown

    HSS Hire

     

  4. Stef
    Admin
    Stef avatar
    3611 posts

    Posted 21 Jun 2017 Link to this post

    Hello Anthony,

    The attached demo project is a WebApplication with Windows Authentication.
    In site.Master we add a link that should lead the user to the Admin Module of the Report Server, after login the user through the exposed Report Server's API:
    <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav">
            <li><a runat="server" href="~/">Home</a></li>
            <li>
                <a id="btnReportServer">Go to Report Server</a>
            </li>
        </ul>
       
        <script>
            var serverHost = "http://localhost:83/";
            var serverApi = serverHost + "api/reportserver/";
            var serverTokenKey = "TelerikReportServerToken";
     
            function login(username, password) {
     
                var accessToken = "";
     
                $.ajax({
                    type: "POST",
                    url: serverHost + "Token",
                    async: false,
                    data: {
                        grant_type: "password",
                        username: username,
                        password: password
                    }
                })
                .done(function (data, textStatus, jqXHR) {
                    accessToken = data.access_token;
                })
                .fail(function (xhr, status, error) {
                    window.alert(xhr.status + ": " + error);
                });
     
                return accessToken;
            }
            $('#btnReportServer').click(function () {
                var accessToken = login("telerik", "telerik123");
                window.sessionStorage.setItem(serverTokenKey, accessToken);
                window.location = serverHost;
            });
        </script>
        <p class="nav navbar-text navbar-right">
            Hello,
            <asp:LoginName runat="server" />
            !
        </p>
    </div>



    Regards,
    Stef
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top