title: Google OpenId: Accept only users of a particular company
body: <p>I am trying to use open id in my application and I have done it successfully with <a href="http://code.google.com/p/dotnetopenid/" rel="nofollow noreferrer">DotNetOpenId</a>.</p>
  
  <p>Now, Google provides service for email and others under the domain of the companies. (Like <em>example@acompany.com</em>). Is there a way to narrow down the authentication to users of a company only?</p>
  
  <p>I know I can do it simply by checking the email address from the response. But I do not think this is a good idea. Its better if the user is NOT authenticated by Google accounts other than that of <em>acompany.com</em>.</p>
  
  <p>Please note that I DONOT know the inside logic of <em>Open Authentication</em> or <em>DotNetOpenId</em>.</p>
  
  <h2>Edit</h2>
  
  <p>By default Google's openId request prompts <em><code>https://accounts.google.com/ServiceLogin?...</code></em></p>
  
  <p>I can manually change it (in the browser) to <em><code>https://accounts.google.com/a/iit.du.ac.bd/ServiceLogin?...</code></em> and it works (<code>iit.du.ac.bd</code> is my school's domain)</p>
  
  <p>I have tried to create request with</p>
  
  <pre><code>        Identifier id1 = Identifier.Parse("https://www.google.com/a/iit.du.ac.bd");
          Identifier id2= Identifier.Parse("https://www.google.com/a/iit.du.ac.bd/accounts/o8/id");
          var openid = new OpenIdRelyingParty();
  
         IAuthenticationRequest request1 = openid.CreateRequest(id1);
         IAuthenticationRequest request2 = openid.CreateRequest(id2);
  </code></pre>
  
  <p>Google's identifier is <code>https://www.google.com/accounts/o8/id"</code></p>
  
  <h2>Edit2</h2>
  
  <p>Just found <a href="https://stackoverflow.com/questions/8877985/google-apps-openid-url">google-apps-openid-url</a></p>