当前位置: 首页>>代码示例>>Java>>正文


Java ExternalGroupsProvider类代码示例

本文整理汇总了Java中org.sonar.api.security.ExternalGroupsProvider的典型用法代码示例。如果您正苦于以下问题:Java ExternalGroupsProvider类的具体用法?Java ExternalGroupsProvider怎么用?Java ExternalGroupsProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExternalGroupsProvider类属于org.sonar.api.security包,在下文中一共展示了ExternalGroupsProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runDoGetGroupsTest

import org.sonar.api.security.ExternalGroupsProvider; //导入依赖的package包/类
private void runDoGetGroupsTest(boolean isUserAuthenticatedByBasicAuth, boolean doesUserExist,
  Collection<WindowsAccount> windowsAccounts, Collection<String> expectedGroups) {
  WindowsPrincipal windowsPrincipal = null;
  int getUserGroupsInvCount = 0;
  if (doesUserExist) {
    windowsPrincipal = Mockito.mock(WindowsPrincipal.class);
    getUserGroupsInvCount = 1;
  }

  HttpServletRequest httpServletRequest = Mockito.mock(HttpServletRequest.class);
  ExternalGroupsProvider.Context context = new ExternalGroupsProvider.Context(null, httpServletRequest);

  String windowsPrincipalKey = WindowsAuthenticationHelper.SSO_PRINCIPAL_KEY;
  if (isUserAuthenticatedByBasicAuth) {
    windowsPrincipalKey = WindowsAuthenticationHelper.BASIC_AUTH_PRINCIPAL_KEY;
  }

  WindowsAuthenticationHelper windowsAuthenticationHelper = Mockito.mock(WindowsAuthenticationHelper.class);
  when(windowsAuthenticationHelper.getWindowsPrincipal(httpServletRequest, windowsPrincipalKey)).thenReturn(windowsPrincipal);
  if (doesUserExist) {
    when(windowsAuthenticationHelper.getUserGroups(windowsPrincipal)).thenReturn(expectedGroups);
  }

  WindowsGroupsProvider groupsProvider = new WindowsGroupsProvider(windowsAuthenticationHelper);

  Collection<String> groups = groupsProvider.doGetGroups(context);

  if (expectedGroups == null) {
    assertThat(groups).isNull();
    verify(windowsAuthenticationHelper, Mockito.times(getUserGroupsInvCount)).getUserGroups(windowsPrincipal);

  } else {
    assertThat(groups).isNotNull().hasSameElementsAs(expectedGroups);
    verify(windowsAuthenticationHelper, Mockito.times(getUserGroupsInvCount)).getUserGroups(windowsPrincipal);
  }
}
 
开发者ID:SonarQubeCommunity,项目名称:sonar-activedirectory,代码行数:37,代码来源:WindowsGroupsProviderTest.java

示例2: getGroupsProvider

import org.sonar.api.security.ExternalGroupsProvider; //导入依赖的package包/类
@Override
public ExternalGroupsProvider getGroupsProvider() {
  return windowsGroupsProvider;
}
 
开发者ID:SonarQubeCommunity,项目名称:sonar-activedirectory,代码行数:5,代码来源:WindowsSecurityRealm.java

示例3: getGroupsProvider

import org.sonar.api.security.ExternalGroupsProvider; //导入依赖的package包/类
@Override
public ExternalGroupsProvider getGroupsProvider() {		
	return super.getGroupsProvider();
}
 
开发者ID:mnadeem,项目名称:sonar-keycloak,代码行数:5,代码来源:KeycloakSecurityRealm.java

示例4: getGroupsProvider

import org.sonar.api.security.ExternalGroupsProvider; //导入依赖的package包/类
/**
 * Return ExternalGroupsProvider.
 *
 * @return {@link ExternalGroupsProvider} associated with this realm, null
 *         if not supported
 */
@Override
public ExternalGroupsProvider getGroupsProvider() {
    return new ADGroupsProvider(adSettings);
}
 
开发者ID:programmingforliving,项目名称:sonar-ad-plugin,代码行数:11,代码来源:ADSecurityRealm.java


注:本文中的org.sonar.api.security.ExternalGroupsProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。