public BasicOAuth2Accessor(final String gadgetUri, final String serviceName, final String user, final String scope, final boolean allowModuleOverrides, final OAuth2Store store, final String globalRedirectUri, final Authority authority, final String contextRoot) { this.gadgetUri = gadgetUri; this.serviceName = serviceName; this.user = user; this.scope = scope; this.allowModuleOverrides = allowModuleOverrides; this.globalRedirectUri = globalRedirectUri; if (store != null) { this.state = new OAuth2CallbackState(store.getStateCrypter()); } else { this.state = new OAuth2CallbackState(); } this.state.setGadgetUri(gadgetUri); this.state.setServiceName(serviceName); this.state.setUser(user); this.state.setScope(scope); this.authority = authority; this.contextRoot = contextRoot; this.errorResponse = false; this.redirecting = false; this.additionalRequestParams = Maps.newHashMap(); }