@Test public void testGetDefaultScopeForScopeToPresentOnAuthorizationPage() { suppress(constructor(DefaultOAuthTokenStoreImpl.class)); OAuth2TokenStore store = mock(DefaultOAuthTokenStoreImpl.class); AMIdentity id = PowerMockito.mock(AMIdentity.class); scopeImpl = new ScopeImpl(store, id); Set<String> requestedScope = new HashSet<String>(); Set<String> availableScope = new HashSet<String>(); Set<String> defaultScope = new HashSet<String>(); defaultScope.add("scope1"); defaultScope.add("scope2"); Set<String> returnedScope = scopeImpl.scopeToPresentOnAuthorizationPage(requestedScope, availableScope, defaultScope); assertEquals(returnedScope, defaultScope); }
public Set<String> scopeToPresentOnAuthorizationPage(Set<String> requestedScope, Set<String> availableScopes, Set<String> defaultScopes){ if (requestedScope == null || requestedScope.isEmpty()) { return defaultScopes; } Set<String> scopes = new HashSet<String>(availableScopes); scopes.retainAll(requestedScope); return scopes; }
ScopeImpl implements Scope { public Set<String> scopeToPresentOnAuthorizationPage(Set<String> requestedScope, Set<String> availableScopes, Set<String> defaultScopes){ if (requestedScope == null || requestedScope.isEmpty()) { return defaultScopes; } Set<String> scopes = new HashSet<String>(availableScopes); scopes.retainAll(requestedScope); return scopes; } }
ScopeImpl implements Scope { public Set<String> scopeToPresentOnAuthorizationPage(Set<String> requestedScope, Set<String> availableScopes, Set<String> defaultScopes){ if (requestedScope == null || requestedScope.isEmpty()) { return defaultScopes; } Set<String> scopes = new HashSet<String>(availableScopes); scopes.retainAll(requestedScope); return scopes; } ScopeImpl();  ScopeImpl(OAuth2TokenStore store, AMIdentity id); }
ScopeImpl implements Scope { public Set<String> scopeToPresentOnAuthorizationPage(Set<String> requestedScope, Set<String> availableScopes, Set<String> defaultScopes){ if (requestedScope == null || requestedScope.isEmpty()) { return defaultScopes; } Set<String> scopes = new HashSet<String>(availableScopes); scopes.retainAll(requestedScope); return scopes; } ScopeImpl();  ScopeImpl(OAuth2TokenStore store, AMIdentity id); Set<String> scopeToPresentOnAuthorizationPage(Set<String> requestedScope, Set<String> availableScopes, Set<String> defaultScopes); Set<String> scopeRequestedForAccessToken(Set<String> requestedScope, Set<String> availableScopes, Set<String> defaultScopes); Set<String> scopeRequestedForRefreshToken(Set<String> requestedScope,
                                                     Set<String> availableScopes,
                                                     Set<String> allScopes,
                                                     Set<String> defaultScopes); Map<String, Object> evaluateScope(CoreToken token); Map<String, Object> extraDataToReturnForTokenEndpoint(Map<String, String> parameters, CoreToken token); Map<String, String> extraDataToReturnForAuthorizeEndpoint(Map<String, String> parameters, Map<String, CoreToken> tokens); Map<String,Object> getUserInfo(CoreToken token); }
ScopeImpl implements Scope { public Set<String> scopeToPresentOnAuthorizationPage(Set<String> requestedScope, Set<String> availableScopes, Set<String> defaultScopes){ if (requestedScope == null || requestedScope.isEmpty()) { return defaultScopes; } Set<String> scopes = new HashSet<String>(availableScopes); scopes.retainAll(requestedScope); return scopes; } ScopeImpl();  ScopeImpl(OAuth2TokenStore store, AMIdentity id); Set<String> scopeToPresentOnAuthorizationPage(Set<String> requestedScope, Set<String> availableScopes, Set<String> defaultScopes); Set<String> scopeRequestedForAccessToken(Set<String> requestedScope, Set<String> availableScopes, Set<String> defaultScopes); Set<String> scopeRequestedForRefreshToken(Set<String> requestedScope,
                                                     Set<String> availableScopes,
                                                     Set<String> allScopes,
                                                     Set<String> defaultScopes); Map<String, Object> evaluateScope(CoreToken token); Map<String, Object> extraDataToReturnForTokenEndpoint(Map<String, String> parameters, CoreToken token); Map<String, String> extraDataToReturnForAuthorizeEndpoint(Map<String, String> parameters, Map<String, CoreToken> tokens); Map<String,Object> getUserInfo(CoreToken token);  }