/// <summary> /// Gets the client with a given identifier. /// </summary> /// <param name="clientIdentifier">The client identifier.</param> /// <returns>The client registration. Never null.</returns> public IClientDescription GetClient(string clientIdentifier) { IOAuth2AuthorizationStoreAgent agent = DependencyInjection.Get <IOAuth2AuthorizationStoreAgent>(); OAuth2ClientApplication clientApplication = agent.GetClientApplication(clientIdentifier); // Does the CLIENT IDENTIFIER exist or is expired ? Oh yes ... then an exception is thrown. if (clientApplication == null) { throw new ArgumentException("No client could be found with the specified client identifier.", "clientIdentifier"); } return(new ClientDescription(clientApplication.Secret, null, ClientType.Public)); }
public OAuth2ClientApplication GetClientApplication(string identifier) { OAuth2ClientApplication entity = null; using (IEntityContext context = DependencyInjection.Get<IEntityContext>()) { using (IOAuth2ClientApplicationRepository repository = DependencyInjection.Get<IOAuth2ClientApplicationRepository>(InjectionParameter.Create("context", context))) { IQueryOver<OAuth2ClientApplication, OAuth2ClientApplication> query = repository .Query() .Where(x => x.Identifier == identifier); entity = query.List().SingleOrDefault(); } context.Commit(); } return entity; }