@Inject public OAuth2StoreProvider( @Named(OAuth2Module.OAUTH2_REDIRECT_URI) final String globalRedirectUri, @Named(OAuth2Module.OAUTH2_IMPORT) final boolean importFromConfig, @Named(OAuth2Module.OAUTH2_IMPORT_CLEAN) final boolean importClean, final Authority authority, final OAuth2Cache cache, final OAuth2Persister persister, final OAuth2Encrypter encrypter, @Nullable @Named("shindig.contextroot") final String contextRoot, @Named(OAuth2FetcherConfig.OAUTH2_STATE_CRYPTER) final BlobCrypter stateCrypter) { this.store = new BasicOAuth2Store(cache, persister, encrypter, globalRedirectUri, authority, contextRoot, stateCrypter); if (importFromConfig) { try { final OAuth2Persister source = new JSONOAuth2Persister(encrypter, authority, globalRedirectUri, contextRoot); BasicOAuth2Store.runImport(source, persister, importClean); } catch (final OAuth2PersistenceException e) { if (OAuth2Module.LOG.isLoggable()) { OAuth2Module.LOG.log("store init exception", e); } } } try { this.store.init(); } catch (final GadgetException e) { if (OAuth2Module.LOG.isLoggable()) { OAuth2Module.LOG.log("store init exception", e); } } }
@Inject public JSONOAuth2Persister(final OAuth2Encrypter encrypter, final Authority authority, final String globalRedirectUri, @Nullable @Named("shindig.contextroot") final String contextRoot) throws OAuth2PersistenceException { this.encrypter = encrypter; this.authority = authority; this.globalRedirectUri = globalRedirectUri; this.contextRoot = contextRoot; try { this.configFile = new JSONObject( JSONOAuth2Persister.getJSONString(JSONOAuth2Persister.OAUTH2_CONFIG)); } catch (final Exception e) { if (JSONOAuth2Persister.LOG.isLoggable()) { JSONOAuth2Persister.LOG.log("OAuth2PersistenceException", e); } throw new OAuth2PersistenceException(e); } }
public Set<OAuth2Client> loadClients() throws OAuth2PersistenceException { final Map<String, OAuth2GadgetBinding> gadgetBindings = this.loadGadgetBindings(); final Map<String, OAuth2Provider> providers = this.loadProviders();
@Test public void testLoadClients_1() throws Exception { final Set<OAuth2Client> result = this.persister.loadClients();
@Test public void testLoadClients_1() throws Exception { final Set<OAuth2Client> result = this.persister.loadClients();
protected static JSONOAuth2Persister getDummyPersister() throws Exception { final JSONObject configFile = new JSONObject(MockUtils.getJSONString()); return new JSONOAuth2Persister(MockUtils.getDummyEncrypter(), MockUtils.getDummyAuthority(), MockUtils.REDIRECT_URI, "xxx", configFile); }
protected static JSONOAuth2Persister getDummyPersister() throws Exception { final JSONObject configFile = new JSONObject(MockUtils.getJSONString()); return new JSONOAuth2Persister(MockUtils.getDummyEncrypter(), MockUtils.getDummyAuthority(), MockUtils.REDIRECT_URI, "xxx", configFile); }