title: How to use Siteminder SSO and Angularjs together?
body: <p>I have to use SiteMinder SSO on the top of my angular application. When user hit given url then route to siteMinder login page. Once login is successfully then I have to take care for all the routes, header and session. I didn't find any relevant resource for anguarjs. Could anyone please help me on this? Do I need to write rest api for this? or there is any magic provided by siteMinder which I can use directly. </p>
  
  <pre><code> @app.route("/", methods =["GET"])
   @app.route("/&lt;bucket_name&gt;", methods =["GET"])
   def auth(bucket_name=None):
     headers = request.headers
     hdr =  dict(headers)
     hdr['bucket'] = bucket_name
     return jsonify(hdr)
  </code></pre>
  
  <p>This python script where request.headers simply gives me whole sso header response (like user name, session, cookie and many more) if I am login and my url is register with sso. That means I am already getting authentication header before calling any rest api and it's binding automatically in my every rest api request right? How can I grab that in anguarjs script?</p>
  
  <p>SiteMinder says SM http header can be accessed through Web Application:</p>
  
  <p>Now questions: </p>
  
  <ol>
  <li><p>Where is good place to access it: client or server side?</p></li>
  <li><p>If from client side then how?</p></li>
  <li><p>If server side then do I need to create separate rest api for this?</p></li>
  <li><p>If in server side then is it okay if I access before my angular app started like this and inject as constant?</p></li>
  </ol>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>function fetchData() {
      var initInjector = angular.injector(["ng"]);
      var $http = initInjector.get("$http");
  
      return $http.get(env.authHeader).then(function(response) {
       flexapp.constant("authHeader", response.data);
       console.log(response);
      }, function(errorResponse) {
          // Handle error case
      });
  }</code></pre>
  </div>
  </div>
  </p>
  
  <ol start="5">
  <li>How do I take care of session?</li>
  </ol>