gluu
公開メンバ関数 | 静的公開メンバ関数 | 静的公開変数類 | 限定公開変数類 | 全メンバ一覧
org.xdi.oxauth.ws.rs.GrantTypesRestrictionHttpTest クラス
org.xdi.oxauth.ws.rs.GrantTypesRestrictionHttpTest の継承関係図
Inheritance graph
org.xdi.oxauth.ws.rs.GrantTypesRestrictionHttpTest 連携図
Collaboration graph

公開メンバ関数

void grantTypesRestriction (final List< ResponseType > responseTypes, final List< ResponseType > expectedResponseTypes, final List< GrantType > grantTypes, final List< GrantType > expectedGrantTypes, final String userId, final String userSecret, final String redirectUris, final String redirectUri, final String sectorIdentifierUri, final String postLogoutRedirectUri, final String logoutUri) throws Exception
 
Object [][] omittedResponseTypesFailDataProvider (ITestContext context)
 
void initTestSuite (ITestContext context) throws FileNotFoundException, IOException
 
WebDriver getDriver ()
 
void setDriver (WebDriver driver)
 
String getAuthorizationEndpoint ()
 
void setAuthorizationEndpoint (String authorizationEndpoint)
 
String getTokenEndpoint ()
 
void setTokenEndpoint (String tokenEndpoint)
 
String getUserInfoEndpoint ()
 
void setUserInfoEndpoint (String userInfoEndpoint)
 
String getClientInfoEndpoint ()
 
void setClientInfoEndpoint (String clientInfoEndpoint)
 
String getCheckSessionIFrame ()
 
void setCheckSessionIFrame (String checkSessionIFrame)
 
String getEndSessionEndpoint ()
 
void setEndSessionEndpoint (String endSessionEndpoint)
 
String getJwksUri ()
 
void setJwksUri (String jwksUri)
 
String getRegistrationEndpoint ()
 
void setRegistrationEndpoint (String registrationEndpoint)
 
String getIntrospectionEndpoint ()
 
void setIntrospectionEndpoint (String p_introspectionEndpoint)
 
Map< String, List< String > > getScopeToClaimsMapping ()
 
void setScopeToClaimsMapping (Map< String, List< String >> p_scopeToClaimsMapping)
 
String getIdGenEndpoint ()
 
void setIdGenEndpoint (String p_idGenEndpoint)
 
String getConfigurationEndpoint ()
 
void setConfigurationEndpoint (String configurationEndpoint)
 
void startSelenium ()
 
void stopSelenium ()
 
AuthorizationResponse authenticateResourceOwnerAndGrantAccess (String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret)
 
AuthorizationResponse authenticateResourceOwnerAndGrantAccess (String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret, boolean cleanupCookies)
 
AuthorizationResponse authenticateResourceOwnerAndGrantAccess (String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret, boolean cleanupCookies, boolean useNewDriver)
 
AuthorizationResponse authenticateResourceOwnerAndGrantAccess (String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret, boolean cleanupCookies, boolean useNewDriver, int authzSteps)
 
AuthorizationResponse authenticateResourceOwnerAndDenyAccess (String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret)
 
AuthorizationResponse authorizationRequestAndGrantAccess (String authorizeUrl, AuthorizationRequest authorizationRequest)
 
AuthorizationResponse authorizationRequestAndDenyAccess (String authorizeUrl, AuthorizationRequest authorizationRequest)
 
AuthorizationResponse authenticateResourceOwner (String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret, boolean cleanupCookies)
 
String waitForResourceOwnerAndGrantLoginForm (String authorizeUrl, AuthorizationRequest authorizationRequest, boolean cleanupCookies)
 
String waitForResourceOwnerAndGrantLoginForm (String authorizeUrl, AuthorizationRequest authorizationRequest)
 
void discovery (ITestContext context) throws Exception
 
void showTitle (String title)
 
void showTitle (String title)
 
void showEntity (String entity)
 
void showResponse (String title, Response response)
 

静的公開メンバ関数

static void showClient (BaseClient client)
 
static void showClient (BaseClient client, CookieStore cookieStore)
 
static void showClientUserAgent (BaseClient client)
 
static void assertErrorResponse (BaseResponseWithErrors p_response, IErrorType p_errorType)
 
static DefaultHttpClient createHttpClient ()
 
static DefaultHttpClient createHttpClient (HostnameVerifierType p_verifierType)
 
static ClientExecutor clientExecutor () throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
 
static ClientExecutor clientExecutor (boolean trustAll) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
 
static HttpClient createHttpClientTrustAll () throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
 
static void showResponse (String title, Response response, Object entity)
 
static void fails (Throwable e)
 
static void output (String p_msg)
 
static Archive<?> createDeployment ()
 

静的公開変数類

static FileConfiguration testData
 

限定公開変数類

WebDriver driver
 
String authorizationEndpoint
 
String authorizationPageEndpoint
 
String gluuConfigurationEndpoint
 
String tokenEndpoint
 
String userInfoEndpoint
 
String clientInfoEndpoint
 
String checkSessionIFrame
 
String endSessionEndpoint
 
String jwksUri
 
String registrationEndpoint
 
String configurationEndpoint
 
String idGenEndpoint
 
String introspectionEndpoint
 
Map< String, List< String > > scopeToClaimsMapping
 

詳解

著者
Javier Rojas Blum
バージョン
November 29, 2017

関数詳解

◆ assertErrorResponse()

static void org.xdi.oxauth.BaseTest.assertErrorResponse ( BaseResponseWithErrors  p_response,
IErrorType  p_errorType 
)
inlinestaticinherited
787  {
788  assertEquals(p_response.getStatus(), 400, "Unexpected response code. Entity: " + p_response.getEntity());
789  assertNotNull(p_response.getEntity(), "The entity is null");
790  assertEquals(p_response.getErrorType(), p_errorType);
791  assertTrue(StringUtils.isNotBlank(p_response.getErrorDescription()));
792  }
T getErrorType()
Definition: BaseResponseWithErrors.java:48
String getEntity()
Definition: BaseResponse.java:85
int getStatus()
Definition: BaseResponse.java:49
String getErrorDescription()
Definition: BaseResponseWithErrors.java:40

◆ authenticateResourceOwner()

AuthorizationResponse org.xdi.oxauth.BaseTest.authenticateResourceOwner ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest,
String  userId,
String  userSecret,
boolean  cleanupCookies 
)
inlineinherited

The authorization server authenticates the resource owner (via the user-agent) No authorization page.

556  {
557  String authorizationRequestUrl = authorizeUrl + "?" + authorizationRequest.getQueryString();
558 
559  AuthorizeClient authorizeClient = new AuthorizeClient(authorizeUrl);
560  authorizeClient.setRequest(authorizationRequest);
561 
562  System.out.println("authenticateResourceOwner: authorizationRequestUrl:" + authorizationRequestUrl);
563  startSelenium();
564  if (cleanupCookies) {
565  System.out.println("authenticateResourceOwner: Cleaning cookies");
567  }
568 // try {
569  driver.navigate().to(authorizationRequestUrl);
570 // } catch (WebDriverException ex) {
571 // if (ex.getCause() instanceof ScriptException) {
572 // System.out.println("authenticateResourceOwner: Script error: " + ex.getMessage());
573 // } else {
574 // throw ex;
575 // }
576 // }
577 
578  if (userSecret != null) {
579  if (userId != null) {
580  WebElement usernameElement = driver.findElement(By.name(loginFormUsername));
581  usernameElement.sendKeys(userId);
582  }
583 
584  WebElement passwordElement = driver.findElement(By.name(loginFormPassword));
585  passwordElement.sendKeys(userSecret);
586 
587  WebElement loginButton = driver.findElement(By.name(loginFormLoginButton));
588 
589  loginButton.click();
590  }
591 
592  String authorizationResponseStr = driver.getCurrentUrl();
593 
594  Cookie sessionStateCookie = driver.manage().getCookieNamed("session_state");
595  String sessionState = null;
596  if (sessionStateCookie != null) {
597  sessionState = sessionStateCookie.getValue();
598  }
599  System.out.println("authenticateResourceOwner: sessionState:" + sessionState);
600 
601  stopSelenium();
602 
603  AuthorizationResponse authorizationResponse = new AuthorizationResponse(authorizationResponseStr);
604  if (authorizationRequest.getRedirectUri() != null && authorizationRequest.getRedirectUri().equals(authorizationResponseStr)) {
605  authorizationResponse.setResponseMode(ResponseMode.FORM_POST);
606  }
607  authorizeClient.setResponse(authorizationResponse);
608  showClientUserAgent(authorizeClient);
609 
610  return authorizationResponse;
611  }
FORM_POST
Definition: ResponseMode.java:33
String loginFormUsername
Definition: BaseTest.java:88
String loginFormPassword
Definition: BaseTest.java:89
void deleteAllCookies()
Definition: BaseTest.java:661
void stopSelenium()
Definition: BaseTest.java:243
Definition: AuthorizeClient.java:29
Definition: ResponseMode.java:16
void startSelenium()
Definition: BaseTest.java:230
String loginFormLoginButton
Definition: BaseTest.java:90
String getRedirectUri()
Definition: AuthorizationRequest.java:184
void setResponseMode(ResponseMode responseMode)
Definition: AuthorizationResponse.java:228
void setRequest(T request)
Definition: BaseClient.java:68
void setResponse(V response)
Definition: BaseClient.java:76
WebDriver driver
Definition: BaseTest.java:70
Definition: AuthorizationResponse.java:32
String getQueryString()
Definition: AuthorizationRequest.java:486
static void showClientUserAgent(BaseClient client)
Definition: BaseTest.java:783

◆ authenticateResourceOwnerAndDenyAccess()

AuthorizationResponse org.xdi.oxauth.BaseTest.authenticateResourceOwnerAndDenyAccess ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest,
String  userId,
String  userSecret 
)
inlineinherited
408  {
409  String authorizationRequestUrl = authorizeUrl + "?" + authorizationRequest.getQueryString();
410 
411  AuthorizeClient authorizeClient = new AuthorizeClient(authorizeUrl);
412  authorizeClient.setRequest(authorizationRequest);
413 
414  System.out.println("authenticateResourceOwnerAndDenyAccess: authorizationRequestUrl:" + authorizationRequestUrl);
415  startSelenium();
416  driver.navigate().to(authorizationRequestUrl);
417 
418  WebElement usernameElement = driver.findElement(By.name(loginFormUsername));
419  WebElement passwordElement = driver.findElement(By.name(loginFormPassword));
420  WebElement loginButton = driver.findElement(By.name(loginFormLoginButton));
421 
422  if (userId != null) {
423  usernameElement.sendKeys(userId);
424  }
425  passwordElement.sendKeys(userSecret);
426  loginButton.click();
427 
428  String authorizationResponseStr = driver.getCurrentUrl();
429 
430  WebElement doNotAllowButton = driver.findElement(By.id(authorizeFormDoNotAllowButton));
431 
432  final String previousURL = driver.getCurrentUrl();
433  doNotAllowButton.click();
434  WebDriverWait wait = new WebDriverWait(driver, 10);
435  wait.until(new ExpectedCondition<Boolean>() {
436  public Boolean apply(WebDriver d) {
437  return (d.getCurrentUrl() != previousURL);
438  }
439  });
440 
441  authorizationResponseStr = driver.getCurrentUrl();
442 
443  Cookie sessionIdCookie = driver.manage().getCookieNamed("session_id");
444  String sessionId = null;
445  if (sessionIdCookie != null) {
446  sessionId = sessionIdCookie.getValue();
447  }
448  System.out.println("authenticateResourceOwnerAndDenyAccess: sessionId:" + sessionId);
449 
450  stopSelenium();
451 
452  AuthorizationResponse authorizationResponse = new AuthorizationResponse(authorizationResponseStr);
453  if (authorizationRequest.getRedirectUri() != null && authorizationRequest.getRedirectUri().equals(authorizationResponseStr)) {
454  authorizationResponse.setResponseMode(ResponseMode.FORM_POST);
455  }
456  authorizationResponse.setSessionId(sessionId);
457  authorizeClient.setResponse(authorizationResponse);
458  showClientUserAgent(authorizeClient);
459 
460  return authorizationResponse;
461  }
FORM_POST
Definition: ResponseMode.java:33
String loginFormUsername
Definition: BaseTest.java:88
String loginFormPassword
Definition: BaseTest.java:89
void stopSelenium()
Definition: BaseTest.java:243
String authorizeFormDoNotAllowButton
Definition: BaseTest.java:92
void setSessionId(String p_sessionId)
Definition: AuthorizationResponse.java:212
Definition: AuthorizeClient.java:29
Definition: ResponseMode.java:16
void startSelenium()
Definition: BaseTest.java:230
String loginFormLoginButton
Definition: BaseTest.java:90
String getRedirectUri()
Definition: AuthorizationRequest.java:184
void setResponseMode(ResponseMode responseMode)
Definition: AuthorizationResponse.java:228
void setRequest(T request)
Definition: BaseClient.java:68
void setResponse(V response)
Definition: BaseClient.java:76
WebDriver driver
Definition: BaseTest.java:70
Definition: AuthorizationResponse.java:32
String getQueryString()
Definition: AuthorizationRequest.java:486
static void showClientUserAgent(BaseClient client)
Definition: BaseTest.java:783

◆ authenticateResourceOwnerAndGrantAccess() [1/4]

AuthorizationResponse org.xdi.oxauth.BaseTest.authenticateResourceOwnerAndGrantAccess ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest,
String  userId,
String  userSecret 
)
inlineinherited

The authorization server authenticates the resource owner (via the user-agent) and establishes whether the resource owner grants or denies the client's access request.

253  {
254  return authenticateResourceOwnerAndGrantAccess(authorizeUrl, authorizationRequest, userId, userSecret, true);
255  }
AuthorizationResponse authenticateResourceOwnerAndGrantAccess(String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret)
Definition: BaseTest.java:252

◆ authenticateResourceOwnerAndGrantAccess() [2/4]

AuthorizationResponse org.xdi.oxauth.BaseTest.authenticateResourceOwnerAndGrantAccess ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest,
String  userId,
String  userSecret,
boolean  cleanupCookies 
)
inlineinherited

The authorization server authenticates the resource owner (via the user-agent) and establishes whether the resource owner grants or denies the client's access request.

262  {
263  return authenticateResourceOwnerAndGrantAccess(authorizeUrl, authorizationRequest, userId, userSecret, cleanupCookies, false);
264  }
AuthorizationResponse authenticateResourceOwnerAndGrantAccess(String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret)
Definition: BaseTest.java:252

◆ authenticateResourceOwnerAndGrantAccess() [3/4]

AuthorizationResponse org.xdi.oxauth.BaseTest.authenticateResourceOwnerAndGrantAccess ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest,
String  userId,
String  userSecret,
boolean  cleanupCookies,
boolean  useNewDriver 
)
inlineinherited

The authorization server authenticates the resource owner (via the user-agent) and establishes whether the resource owner grants or denies the client's access request.

272  {
273  return authenticateResourceOwnerAndGrantAccess(authorizeUrl, authorizationRequest, userId, userSecret, cleanupCookies, useNewDriver, 1);
274  }
AuthorizationResponse authenticateResourceOwnerAndGrantAccess(String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret)
Definition: BaseTest.java:252

◆ authenticateResourceOwnerAndGrantAccess() [4/4]

AuthorizationResponse org.xdi.oxauth.BaseTest.authenticateResourceOwnerAndGrantAccess ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest,
String  userId,
String  userSecret,
boolean  cleanupCookies,
boolean  useNewDriver,
int  authzSteps 
)
inlineinherited

The authorization server authenticates the resource owner (via the user-agent) and establishes whether the resource owner grants or denies the client's access request.

282  {
283  WebDriver currentDriver = initWebDriver(useNewDriver, cleanupCookies);
284 
285  AuthorizeClient authorizeClient = processAuthentication(currentDriver, authorizeUrl, authorizationRequest,
286  userId, userSecret);
287 
288  int remainAuthzSteps = authzSteps;
289 
290  String authorizationResponseStr = null;
291  do {
292  authorizationResponseStr = acceptAuthorization(currentDriver);
293  remainAuthzSteps--;
294  } while (remainAuthzSteps >= 1);
295 
296  AuthorizationResponse authorizationResponse = buildAuthorizationResponse(authorizationRequest, useNewDriver,
297  currentDriver, authorizeClient, authorizationResponseStr);
298 
299  stopWebDriver(useNewDriver, currentDriver);
300 
301  return authorizationResponse;
302  }
AuthorizationResponse buildAuthorizationResponse(AuthorizationRequest authorizationRequest, boolean useNewDriver, WebDriver currentDriver, AuthorizeClient authorizeClient, String authorizationResponseStr)
Definition: BaseTest.java:387
String acceptAuthorization(WebDriver currentDriver)
Definition: BaseTest.java:358
AuthorizeClient processAuthentication(WebDriver currentDriver, String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret)
Definition: BaseTest.java:330
Definition: AuthorizeClient.java:29
WebDriver initWebDriver(boolean useNewDriver, boolean cleanupCookies)
Definition: BaseTest.java:304
Definition: AuthorizationResponse.java:32
void stopWebDriver(boolean useNewDriver, WebDriver currentDriver)
Definition: BaseTest.java:321

◆ authorizationRequestAndDenyAccess()

AuthorizationResponse org.xdi.oxauth.BaseTest.authorizationRequestAndDenyAccess ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest 
)
inlineinherited
509  {
510  String authorizationRequestUrl = authorizeUrl + "?" + authorizationRequest.getQueryString();
511 
512  AuthorizeClient authorizeClient = new AuthorizeClient(authorizeUrl);
513  authorizeClient.setRequest(authorizationRequest);
514 
515  System.out.println("authorizationRequestAndDenyAccess: authorizationRequestUrl:" + authorizationRequestUrl);
516  startSelenium();
517  driver.navigate().to(authorizationRequestUrl);
518 
519  WebElement doNotAllowButton = driver.findElement(By.id(authorizeFormDoNotAllowButton));
520 
521  final String previousURL = driver.getCurrentUrl();
522  doNotAllowButton.click();
523  WebDriverWait wait = new WebDriverWait(driver, 10);
524  wait.until(new ExpectedCondition<Boolean>() {
525  public Boolean apply(WebDriver d) {
526  return (d.getCurrentUrl() != previousURL);
527  }
528  });
529 
530  String authorizationResponseStr = driver.getCurrentUrl();
531 
532  Cookie sessionStateCookie = driver.manage().getCookieNamed("session_state");
533  String sessionState = null;
534  if (sessionStateCookie != null) {
535  sessionState = sessionStateCookie.getValue();
536  }
537  System.out.println("authorizationRequestAndDenyAccess: sessionState:" + sessionState);
538 
539  stopSelenium();
540 
541  AuthorizationResponse authorizationResponse = new AuthorizationResponse(authorizationResponseStr);
542  if (authorizationRequest.getRedirectUri() != null && authorizationRequest.getRedirectUri().equals(authorizationResponseStr)) {
543  authorizationResponse.setResponseMode(ResponseMode.FORM_POST);
544  }
545  authorizeClient.setResponse(authorizationResponse);
546  showClientUserAgent(authorizeClient);
547 
548  return authorizationResponse;
549  }
FORM_POST
Definition: ResponseMode.java:33
void stopSelenium()
Definition: BaseTest.java:243
String authorizeFormDoNotAllowButton
Definition: BaseTest.java:92
Definition: AuthorizeClient.java:29
Definition: ResponseMode.java:16
void startSelenium()
Definition: BaseTest.java:230
String getRedirectUri()
Definition: AuthorizationRequest.java:184
void setResponseMode(ResponseMode responseMode)
Definition: AuthorizationResponse.java:228
void setRequest(T request)
Definition: BaseClient.java:68
void setResponse(V response)
Definition: BaseClient.java:76
WebDriver driver
Definition: BaseTest.java:70
Definition: AuthorizationResponse.java:32
String getQueryString()
Definition: AuthorizationRequest.java:486
static void showClientUserAgent(BaseClient client)
Definition: BaseTest.java:783

◆ authorizationRequestAndGrantAccess()

AuthorizationResponse org.xdi.oxauth.BaseTest.authorizationRequestAndGrantAccess ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest 
)
inlineinherited
464  {
465  String authorizationRequestUrl = authorizeUrl + "?" + authorizationRequest.getQueryString();
466 
467  AuthorizeClient authorizeClient = new AuthorizeClient(authorizeUrl);
468  authorizeClient.setRequest(authorizationRequest);
469 
470  System.out.println("authorizationRequestAndGrantAccess: authorizationRequestUrl:" + authorizationRequestUrl);
471  startSelenium();
472  driver.navigate().to(authorizationRequestUrl);
473 
474  String authorizationResponseStr = driver.getCurrentUrl();
475 
476  WebElement allowButton = driver.findElement(By.id(authorizeFormAllowButton));
477 
478  final String previousURL = driver.getCurrentUrl();
479  allowButton.click();
480  WebDriverWait wait = new WebDriverWait(driver, 10);
481  wait.until(new ExpectedCondition<Boolean>() {
482  public Boolean apply(WebDriver d) {
483  return (d.getCurrentUrl() != previousURL);
484  }
485  });
486 
487  authorizationResponseStr = driver.getCurrentUrl();
488 
489  Cookie sessionStateCookie = driver.manage().getCookieNamed("session_state");
490  String sessionState = null;
491  if (sessionStateCookie != null) {
492  sessionState = sessionStateCookie.getValue();
493  }
494  System.out.println("authorizationRequestAndGrantAccess: sessionState:" + sessionState);
495 
496  stopSelenium();
497 
498  AuthorizationResponse authorizationResponse = new AuthorizationResponse(authorizationResponseStr);
499  if (authorizationRequest.getRedirectUri() != null && authorizationRequest.getRedirectUri().equals(authorizationResponseStr)) {
500  authorizationResponse.setResponseMode(ResponseMode.FORM_POST);
501  }
502  authorizeClient.setResponse(authorizationResponse);
503  showClientUserAgent(authorizeClient);
504 
505  return authorizationResponse;
506  }
FORM_POST
Definition: ResponseMode.java:33
void stopSelenium()
Definition: BaseTest.java:243
Definition: AuthorizeClient.java:29
Definition: ResponseMode.java:16
void startSelenium()
Definition: BaseTest.java:230
String getRedirectUri()
Definition: AuthorizationRequest.java:184
void setResponseMode(ResponseMode responseMode)
Definition: AuthorizationResponse.java:228
void setRequest(T request)
Definition: BaseClient.java:68
void setResponse(V response)
Definition: BaseClient.java:76
WebDriver driver
Definition: BaseTest.java:70
Definition: AuthorizationResponse.java:32
String getQueryString()
Definition: AuthorizationRequest.java:486
static void showClientUserAgent(BaseClient client)
Definition: BaseTest.java:783
String authorizeFormAllowButton
Definition: BaseTest.java:91

◆ clientExecutor() [1/2]

static ClientExecutor org.xdi.oxauth.BaseTest.clientExecutor ( ) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
inlinestaticinherited
822  {
823  return clientExecutor(false);
824  }
static ClientExecutor clientExecutor()
Definition: BaseTest.java:822

◆ clientExecutor() [2/2]

static ClientExecutor org.xdi.oxauth.BaseTest.clientExecutor ( boolean  trustAll) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
inlinestaticinherited
826  {
827  if (trustAll) {
828  return new ApacheHttpClient4Executor(createHttpClientTrustAll());
829  }
830  return ClientRequest.getDefaultExecutor();
831  }
static HttpClient createHttpClientTrustAll()
Definition: BaseTest.java:833

◆ createDeployment()

static Archive<?> org.xdi.oxauth.ConfigurableTest.createDeployment ( )
inlinestaticinherited
40  {
41  return Deployments.createDeployment();
42  }

◆ createHttpClient() [1/2]

static DefaultHttpClient org.xdi.oxauth.BaseTest.createHttpClient ( )
inlinestaticinherited
794  {
795  return createHttpClient(HostnameVerifierType.DEFAULT);
796  }
static DefaultHttpClient createHttpClient()
Definition: BaseTest.java:794

◆ createHttpClient() [2/2]

static DefaultHttpClient org.xdi.oxauth.BaseTest.createHttpClient ( HostnameVerifierType  p_verifierType)
inlinestaticinherited
798  {
799  if (p_verifierType != null && p_verifierType != HostnameVerifierType.DEFAULT) {
800  switch (p_verifierType) {
801  case ALLOW_ALL:
802  HostnameVerifier hostnameVerifier = org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
803 
804  DefaultHttpClient client = new DefaultHttpClient();
805 
806  SchemeRegistry registry = new SchemeRegistry();
807  SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();
808  socketFactory.setHostnameVerifier((X509HostnameVerifier) hostnameVerifier);
809  registry.register(new Scheme("https", socketFactory, 443));
810  SingleClientConnManager mgr = new SingleClientConnManager(client.getParams(), registry);
811 
812  // Set verifier
813  HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);
814  return new DefaultHttpClient(mgr, client.getParams());
815  case DEFAULT:
816  return new DefaultHttpClient();
817  }
818  }
819  return new DefaultHttpClient();
820  }

◆ createHttpClientTrustAll()

static HttpClient org.xdi.oxauth.BaseTest.createHttpClientTrustAll ( ) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException
inlinestaticinherited
833  {
834  SSLSocketFactory sf = new SSLSocketFactory(new TrustStrategy() {
835  @Override
836  public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
837  return true;
838  }
839  }, new AllowAllHostnameVerifier());
840 
841  SchemeRegistry registry = new SchemeRegistry();
842  registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
843  registry.register(new Scheme("https", 443, sf));
844  ClientConnectionManager ccm = new PoolingClientConnectionManager(registry);
845  return new DefaultHttpClient(ccm);
846  }

◆ discovery()

void org.xdi.oxauth.BaseTest.discovery ( ITestContext  context) throws Exception
inlineinherited
670  {
671  // Load Form Interaction
672  loginFormUsername = context.getCurrentXmlTest().getParameter("loginFormUsername");
673  loginFormPassword = context.getCurrentXmlTest().getParameter("loginFormPassword");
674  loginFormLoginButton = context.getCurrentXmlTest().getParameter("loginFormLoginButton");
675  authorizeFormAllowButton = context.getCurrentXmlTest().getParameter("authorizeFormAllowButton");
676  authorizeFormDoNotAllowButton = context.getCurrentXmlTest().getParameter("authorizeFormDoNotAllowButton");
677 
678  String resource = context.getCurrentXmlTest().getParameter("swdResource");
679 
680  if (StringUtils.isNotBlank(resource)) {
681 
682  showTitle("OpenID Connect Discovery");
683 
684  OpenIdConnectDiscoveryClient openIdConnectDiscoveryClient = new OpenIdConnectDiscoveryClient(resource);
685  OpenIdConnectDiscoveryResponse openIdConnectDiscoveryResponse = openIdConnectDiscoveryClient.exec(clientExecutor(true));
686 
687  showClient(openIdConnectDiscoveryClient);
688  assertEquals(openIdConnectDiscoveryResponse.getStatus(), 200, "Unexpected response code");
689  assertNotNull(openIdConnectDiscoveryResponse.getSubject());
690  assertTrue(openIdConnectDiscoveryResponse.getLinks().size() > 0);
691 
692  configurationEndpoint = openIdConnectDiscoveryResponse.getLinks().get(0).getHref() +
693  "/.well-known/openid-configuration";
694 
695  System.out.println("OpenID Connect Configuration");
696 
697  OpenIdConfigurationClient client = new OpenIdConfigurationClient(configurationEndpoint);
698  client.setExecutor(clientExecutor(true));
700 
701  showClient(client);
702  assertEquals(response.getStatus(), 200, "Unexpected response code");
703  assertNotNull(response.getIssuer(), "The issuer is null");
704  assertNotNull(response.getAuthorizationEndpoint(), "The authorizationEndpoint is null");
705  assertNotNull(response.getTokenEndpoint(), "The tokenEndpoint is null");
706  assertNotNull(response.getUserInfoEndpoint(), "The userInfoEndPoint is null");
707  assertNotNull(response.getJwksUri(), "The jwksUri is null");
708  assertNotNull(response.getRegistrationEndpoint(), "The registrationEndpoint is null");
709 
710  assertTrue(response.getScopesSupported().size() > 0, "The scopesSupported is empty");
711  assertTrue(response.getScopeToClaimsMapping().size() > 0, "The scope to claims mapping is empty");
712  assertTrue(response.getResponseTypesSupported().size() > 0, "The responseTypesSupported is empty");
713  assertTrue(response.getGrantTypesSupported().size() > 0, "The grantTypesSupported is empty");
714  assertTrue(response.getAcrValuesSupported().size() >= 0, "The acrValuesSupported is empty");
715  assertTrue(response.getSubjectTypesSupported().size() > 0, "The subjectTypesSupported is empty");
716  assertTrue(response.getIdTokenSigningAlgValuesSupported().size() > 0, "The idTokenSigningAlgValuesSupported is empty");
717  assertTrue(response.getRequestObjectSigningAlgValuesSupported().size() > 0, "The requestObjectSigningAlgValuesSupported is empty");
718  assertTrue(response.getTokenEndpointAuthMethodsSupported().size() > 0, "The tokenEndpointAuthMethodsSupported is empty");
719  assertTrue(response.getClaimsSupported().size() > 0, "The claimsSupported is empty");
720 
722  tokenEndpoint = response.getTokenEndpoint();
727  jwksUri = response.getJwksUri();
732  gluuConfigurationEndpoint = determineGluuConfigurationEndpoint(openIdConnectDiscoveryResponse.getLinks().get(0).getHref());
733  } else {
734  showTitle("Loading configuration endpoints from properties file");
735 
736  authorizationEndpoint = context.getCurrentXmlTest().getParameter("authorizationEndpoint");
737  tokenEndpoint = context.getCurrentXmlTest().getParameter("tokenEndpoint");
738  userInfoEndpoint = context.getCurrentXmlTest().getParameter("userInfoEndpoint");
739  clientInfoEndpoint = context.getCurrentXmlTest().getParameter("clientInfoEndpoint");
740  checkSessionIFrame = context.getCurrentXmlTest().getParameter("checkSessionIFrame");
741  endSessionEndpoint = context.getCurrentXmlTest().getParameter("endSessionEndpoint");
742  jwksUri = context.getCurrentXmlTest().getParameter("jwksUri");
743  registrationEndpoint = context.getCurrentXmlTest().getParameter("registrationEndpoint");
744  configurationEndpoint = context.getCurrentXmlTest().getParameter("configurationEndpoint");
745  idGenEndpoint = context.getCurrentXmlTest().getParameter("idGenEndpoint");
746  introspectionEndpoint = context.getCurrentXmlTest().getParameter("introspectionEndpoint");
747  scopeToClaimsMapping = new HashMap<String, List<String>>();
748  }
749 
751  }
String registrationEndpoint
Definition: BaseTest.java:81
String getIntrospectionEndpoint()
Definition: OpenIdConfigurationResponse.java:343
List< String > getTokenEndpointAuthMethodsSupported()
Definition: OpenIdConfigurationResponse.java:642
String determineAuthorizationPageEndpoint(String authorizationEndpoint)
Definition: BaseTest.java:753
String jwksUri
Definition: BaseTest.java:80
String getRegistrationEndpoint()
Definition: OpenIdConfigurationResponse.java:310
String clientInfoEndpoint
Definition: BaseTest.java:77
String getCheckSessionIFrame()
Definition: OpenIdConfigurationResponse.java:248
String authorizationPageEndpoint
Definition: BaseTest.java:73
String idGenEndpoint
Definition: BaseTest.java:83
String getIdGenerationEndpoint()
Definition: OpenIdConfigurationResponse.java:327
static void showClient(BaseClient client)
Definition: BaseTest.java:775
List< String > getRequestObjectSigningAlgValuesSupported()
Definition: OpenIdConfigurationResponse.java:579
String loginFormUsername
Definition: BaseTest.java:88
String loginFormPassword
Definition: BaseTest.java:89
String configurationEndpoint
Definition: BaseTest.java:82
List< String > getSubjectTypesSupported()
Definition: OpenIdConfigurationResponse.java:438
String getEndSessionEndpoint()
Definition: OpenIdConfigurationResponse.java:268
String tokenEndpoint
Definition: BaseTest.java:75
String authorizeFormDoNotAllowButton
Definition: BaseTest.java:92
List< String > getAcrValuesSupported()
Definition: OpenIdConfigurationResponse.java:418
String getClientInfoEndpoint()
Definition: OpenIdConfigurationResponse.java:228
List< String > getGrantTypesSupported()
Definition: OpenIdConfigurationResponse.java:398
String checkSessionIFrame
Definition: BaseTest.java:78
void setExecutor(ClientExecutor executor)
Definition: BaseClient.java:84
OpenIdConfigurationResponse execOpenIdConfiguration()
Definition: OpenIdConfigurationClient.java:47
String loginFormLoginButton
Definition: BaseTest.java:90
String gluuConfigurationEndpoint
Definition: BaseTest.java:74
Map< String, List< String > > getScopeToClaimsMapping()
Definition: OpenIdConfigurationResponse.java:136
String getJwksUri()
Definition: OpenIdConfigurationResponse.java:289
String getTokenEndpoint()
Definition: OpenIdConfigurationResponse.java:192
List< String > getIdTokenSigningAlgValuesSupported()
Definition: OpenIdConfigurationResponse.java:519
Definition: OpenIdConnectDiscoveryClient.java:29
String introspectionEndpoint
Definition: BaseTest.java:84
void showTitle(String title)
Definition: BaseTest.java:761
List< String > getResponseTypesSupported()
Definition: OpenIdConfigurationResponse.java:378
String endSessionEndpoint
Definition: BaseTest.java:79
String getSubject()
Definition: OpenIdConnectDiscoveryResponse.java:32
List< String > getScopesSupported()
Definition: OpenIdConfigurationResponse.java:360
String determineGluuConfigurationEndpoint(String host)
Definition: BaseTest.java:757
OpenIdConnectDiscoveryResponse exec()
Definition: OpenIdConnectDiscoveryClient.java:47
String getAuthorizationEndpoint()
Definition: OpenIdConfigurationResponse.java:174
String userInfoEndpoint
Definition: BaseTest.java:76
Definition: OpenIdConfigurationClient.java:27
int getStatus()
Definition: BaseResponse.java:49
List< WebFingerLink > getLinks()
Definition: OpenIdConnectDiscoveryResponse.java:40
List< String > getClaimsSupported()
Definition: OpenIdConfigurationResponse.java:728
Definition: OpenIdConnectDiscoveryResponse.java:17
String authorizationEndpoint
Definition: BaseTest.java:72
String getUserInfoEndpoint()
Definition: OpenIdConfigurationResponse.java:210
Definition: OpenIdConfigurationResponse.java:26
static ClientExecutor clientExecutor()
Definition: BaseTest.java:822
Map< String, List< String > > scopeToClaimsMapping
Definition: BaseTest.java:85
String authorizeFormAllowButton
Definition: BaseTest.java:91
String getIssuer()
Definition: OpenIdConfigurationResponse.java:156

◆ fails()

static void org.xdi.oxauth.BaseTest.fails ( Throwable  e)
inlinestaticinherited
50  {
51  Assert.fail(e.getMessage(), e);
52  }

◆ getAuthorizationEndpoint()

String org.xdi.oxauth.BaseTest.getAuthorizationEndpoint ( )
inlineinherited
134  {
135  return authorizationEndpoint;
136  }
String authorizationEndpoint
Definition: BaseTest.java:72

◆ getCheckSessionIFrame()

String org.xdi.oxauth.BaseTest.getCheckSessionIFrame ( )
inlineinherited
166  {
167  return checkSessionIFrame;
168  }
String checkSessionIFrame
Definition: BaseTest.java:78

◆ getClientInfoEndpoint()

String org.xdi.oxauth.BaseTest.getClientInfoEndpoint ( )
inlineinherited
158  {
159  return clientInfoEndpoint;
160  }
String clientInfoEndpoint
Definition: BaseTest.java:77

◆ getConfigurationEndpoint()

String org.xdi.oxauth.BaseTest.getConfigurationEndpoint ( )
inlineinherited
222  {
223  return configurationEndpoint;
224  }
String configurationEndpoint
Definition: BaseTest.java:82

◆ getDriver()

WebDriver org.xdi.oxauth.BaseTest.getDriver ( )
inlineinherited
126  {
127  return driver;
128  }
WebDriver driver
Definition: BaseTest.java:70

◆ getEndSessionEndpoint()

String org.xdi.oxauth.BaseTest.getEndSessionEndpoint ( )
inlineinherited
174  {
175  return endSessionEndpoint;
176  }
String endSessionEndpoint
Definition: BaseTest.java:79

◆ getIdGenEndpoint()

String org.xdi.oxauth.BaseTest.getIdGenEndpoint ( )
inlineinherited
214  {
215  return idGenEndpoint;
216  }
String idGenEndpoint
Definition: BaseTest.java:83

◆ getIntrospectionEndpoint()

String org.xdi.oxauth.BaseTest.getIntrospectionEndpoint ( )
inlineinherited
198  {
199  return introspectionEndpoint;
200  }
String introspectionEndpoint
Definition: BaseTest.java:84

◆ getJwksUri()

String org.xdi.oxauth.BaseTest.getJwksUri ( )
inlineinherited
182  {
183  return jwksUri;
184  }
String jwksUri
Definition: BaseTest.java:80

◆ getRegistrationEndpoint()

String org.xdi.oxauth.BaseTest.getRegistrationEndpoint ( )
inlineinherited
190  {
191  return registrationEndpoint;
192  }
String registrationEndpoint
Definition: BaseTest.java:81

◆ getScopeToClaimsMapping()

Map<String, List<String> > org.xdi.oxauth.BaseTest.getScopeToClaimsMapping ( )
inlineinherited
206  {
207  return scopeToClaimsMapping;
208  }
Map< String, List< String > > scopeToClaimsMapping
Definition: BaseTest.java:85

◆ getTokenEndpoint()

String org.xdi.oxauth.BaseTest.getTokenEndpoint ( )
inlineinherited
142  {
143  return tokenEndpoint;
144  }
String tokenEndpoint
Definition: BaseTest.java:75

◆ getUserInfoEndpoint()

String org.xdi.oxauth.BaseTest.getUserInfoEndpoint ( )
inlineinherited
150  {
151  return userInfoEndpoint;
152  }
String userInfoEndpoint
Definition: BaseTest.java:76

◆ grantTypesRestriction()

void org.xdi.oxauth.ws.rs.GrantTypesRestrictionHttpTest.grantTypesRestriction ( final List< ResponseType responseTypes,
final List< ResponseType expectedResponseTypes,
final List< GrantType grantTypes,
final List< GrantType expectedGrantTypes,
final String  userId,
final String  userSecret,
final String  redirectUris,
final String  redirectUri,
final String  sectorIdentifierUri,
final String  postLogoutRedirectUri,
final String  logoutUri 
) throws Exception
inline
48  {
49  showTitle("grantTypesRestriction");
50 
51  List<String> scopes = Arrays.asList("openid", "profile", "address", "email", "user_name");
52 
53  // 1. Register client
54  RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app",
55  StringUtils.spaceSeparatedToList(redirectUris));
56  registerRequest.setResponseTypes(responseTypes);
57  registerRequest.setGrantTypes(grantTypes);
58  registerRequest.setScope(scopes);
59  registerRequest.setSubjectType(SubjectType.PAIRWISE);
60  registerRequest.setSectorIdentifierUri(sectorIdentifierUri);
61  registerRequest.setPostLogoutRedirectUris(Arrays.asList(postLogoutRedirectUri));
62  registerRequest.setFrontChannelLogoutUris(Lists.newArrayList(logoutUri));
63 
65  registerClient.setRequest(registerRequest);
66  RegisterResponse registerResponse = registerClient.exec();
67 
68  showClient(registerClient);
69  assertEquals(registerResponse.getStatus(), 200);
70  assertNotNull(registerResponse.getClientId());
71  assertNotNull(registerResponse.getClientSecret());
72  assertNotNull(registerResponse.getRegistrationAccessToken());
73  assertNotNull(registerResponse.getClientIdIssuedAt());
74  assertNotNull(registerResponse.getClientSecretExpiresAt());
75  assertNotNull(registerResponse.getResponseTypes());
76  assertTrue(registerResponse.getResponseTypes().containsAll(expectedResponseTypes));
77  assertNotNull(registerResponse.getGrantTypes());
78  assertTrue(registerResponse.getGrantTypes().containsAll(expectedGrantTypes));
79 
80  String clientId = registerResponse.getClientId();
81  String clientSecret = registerResponse.getClientSecret();
82  String registrationAccessToken = registerResponse.getRegistrationAccessToken();
83  String registrationClientUri = registerResponse.getRegistrationClientUri();
84 
85  // 2. Client read
86  RegisterRequest readRequest = new RegisterRequest(registrationAccessToken);
87 
88  RegisterClient readClient = new RegisterClient(registrationClientUri);
89  readClient.setRequest(readRequest);
90  RegisterResponse readResponse = registerClient.exec();
91 
92  showClient(registerClient);
93  assertEquals(readResponse.getStatus(), 200);
94  assertNotNull(readResponse.getClientId());
95  assertNotNull(readResponse.getClientSecret());
96  assertNotNull(readResponse.getRegistrationAccessToken());
97  assertNotNull(readResponse.getRegistrationClientUri());
98  assertNotNull(readResponse.getClientSecretExpiresAt());
99  assertNotNull(readResponse.getClaims().get(APPLICATION_TYPE.toString()));
100  assertNotNull(readResponse.getClaims().get(SCOPE.toString()));
101  assertNotNull(readResponse.getResponseTypes());
102  assertTrue(readResponse.getResponseTypes().containsAll(expectedResponseTypes));
103  assertNotNull(readResponse.getGrantTypes());
104  assertTrue(readResponse.getGrantTypes().containsAll(expectedGrantTypes));
105 
106  // 3. Request authorization
107  String nonce = UUID.randomUUID().toString();
108  String state = UUID.randomUUID().toString();
109 
110  AuthorizationRequest authorizationRequest = new AuthorizationRequest(expectedResponseTypes, clientId, scopes, redirectUri, nonce);
111  authorizationRequest.setState(state);
112 
113  if (expectedResponseTypes.size() == 0) {
115  authorizeClient.setRequest(authorizationRequest);
116  AuthorizationResponse authorizationResponse = authorizeClient.exec();
117 
118  showClient(authorizeClient);
119  assertEquals(authorizationResponse.getStatus(), 302);
120  assertNotNull(authorizationResponse.getLocation());
121  assertNotNull(authorizationResponse.getErrorType());
122  assertNotNull(authorizationResponse.getErrorDescription());
123  assertNotNull(authorizationResponse.getState());
124 
125  return;
126  }
127 
129  authorizationEndpoint, authorizationRequest, userId, userSecret);
130 
131  String scope = authorizationResponse.getScope();
132  String authorizationCode = null;
133  String accessToken = null;
134  String idToken = null;
135  String refreshToken = null;
136 
137  assertNotNull(authorizationResponse.getLocation());
138  assertNotNull(authorizationResponse.getState());
139  assertNotNull(authorizationResponse.getScope());
140  if (expectedResponseTypes.contains(ResponseType.CODE)) {
141  assertNotNull(authorizationResponse.getCode());
142 
143  authorizationCode = authorizationResponse.getCode();
144  }
145  if (expectedResponseTypes.contains(ResponseType.TOKEN)) {
146  assertNotNull(authorizationResponse.getAccessToken());
147 
148  accessToken = authorizationResponse.getAccessToken();
149  }
150  if (expectedResponseTypes.contains(ResponseType.ID_TOKEN)) {
151  assertNotNull(authorizationResponse.getIdToken());
152 
153  idToken = authorizationResponse.getIdToken();
154 
155  // 4. Validate id_token
156  Jwt jwt = Jwt.parse(idToken);
157  assertNotNull(jwt.getHeader().getClaimAsString(JwtHeaderName.TYPE));
158  assertNotNull(jwt.getHeader().getClaimAsString(JwtHeaderName.ALGORITHM));
159  assertNotNull(jwt.getClaims().getClaimAsString(JwtClaimName.ISSUER));
160  assertNotNull(jwt.getClaims().getClaimAsString(JwtClaimName.AUDIENCE));
161  assertNotNull(jwt.getClaims().getClaimAsString(JwtClaimName.EXPIRATION_TIME));
162  assertNotNull(jwt.getClaims().getClaimAsString(JwtClaimName.ISSUED_AT));
163  assertNotNull(jwt.getClaims().getClaimAsString(JwtClaimName.SUBJECT_IDENTIFIER));
164  assertNotNull(jwt.getClaims().getClaimAsString(JwtClaimName.AUTHENTICATION_TIME));
165 
167  jwksUri,
168  jwt.getHeader().getClaimAsString(JwtHeaderName.KEY_ID));
169  RSASigner rsaSigner = new RSASigner(SignatureAlgorithm.RS256, publicKey);
170 
171  assertTrue(rsaSigner.validate(jwt));
172 
173  if (expectedResponseTypes.contains(ResponseType.CODE)) {
174  assertNotNull(jwt.getClaims().getClaimAsString(JwtClaimName.CODE_HASH));
175  assertTrue(rsaSigner.validateAuthorizationCode(authorizationCode, jwt));
176  }
177  if (expectedResponseTypes.contains(ResponseType.TOKEN)) {
178  assertNotNull(jwt.getClaims().getClaimAsString(JwtClaimName.ACCESS_TOKEN_HASH));
179  assertTrue(rsaSigner.validateAccessToken(accessToken, jwt));
180  }
181  }
182 
183  if (expectedResponseTypes.contains(ResponseType.CODE)) {
184  // 5. Request access token using the authorization code.
186  tokenRequest.setCode(authorizationCode);
187  tokenRequest.setRedirectUri(redirectUri);
188  tokenRequest.setAuthUsername(clientId);
189  tokenRequest.setAuthPassword(clientSecret);
191 
192  TokenClient tokenClient = new TokenClient(tokenEndpoint);
193  tokenClient.setRequest(tokenRequest);
194  TokenResponse tokenResponse = tokenClient.exec();
195 
196  showClient(tokenClient);
197  assertEquals(tokenResponse.getStatus(), 200);
198  assertNotNull(tokenResponse.getEntity());
199  assertNotNull(tokenResponse.getAccessToken());
200  assertNotNull(tokenResponse.getExpiresIn());
201  assertNotNull(tokenResponse.getTokenType());
202 
203  if (expectedGrantTypes.contains(GrantType.REFRESH_TOKEN)) {
204  assertNotNull(tokenResponse.getRefreshToken());
205 
206  refreshToken = tokenResponse.getRefreshToken();
207 
208  // 6. Request new access token using the refresh token.
209  TokenClient refreshTokenClient = new TokenClient(tokenEndpoint);
210  TokenResponse refreshTokenResponse = refreshTokenClient.execRefreshToken(scope, refreshToken, clientId, clientSecret);
211 
212  showClient(refreshTokenClient);
213  assertEquals(refreshTokenResponse.getStatus(), 200);
214  assertNotNull(refreshTokenResponse.getEntity());
215  assertNotNull(refreshTokenResponse.getAccessToken());
216  assertNotNull(refreshTokenResponse.getTokenType());
217  assertNotNull(refreshTokenResponse.getRefreshToken());
218  assertNotNull(refreshTokenResponse.getScope());
219 
220  accessToken = refreshTokenResponse.getAccessToken();
221  } else {
222  assertNull(tokenResponse.getRefreshToken());
223  }
224  }
225 
226  if (accessToken != null) {
227  // 7. Request user info
228  UserInfoClient userInfoClient = new UserInfoClient(userInfoEndpoint);
229  UserInfoResponse userInfoResponse = userInfoClient.execUserInfo(accessToken);
230 
231  showClient(userInfoClient);
232  assertEquals(userInfoResponse.getStatus(), 200);
233  assertNotNull(userInfoResponse.getClaim(JwtClaimName.SUBJECT_IDENTIFIER));
234  assertNotNull(userInfoResponse.getClaim(JwtClaimName.NAME));
235  assertNotNull(userInfoResponse.getClaim(JwtClaimName.FAMILY_NAME));
236  assertNotNull(userInfoResponse.getClaim(JwtClaimName.EMAIL));
237  assertNotNull(userInfoResponse.getClaim(JwtClaimName.ADDRESS));
238 
239  if (idToken != null) {
240  // 8. End session
241  String endSessionId = UUID.randomUUID().toString();
242  EndSessionRequest endSessionRequest = new EndSessionRequest(idToken, postLogoutRedirectUri, endSessionId);
243  endSessionRequest.setSessionId(authorizationResponse.getSessionId());
244 
245  EndSessionClient endSessionClient = new EndSessionClient(endSessionEndpoint);
246  endSessionClient.setRequest(endSessionRequest);
247 
248  EndSessionResponse endSessionResponse = endSessionClient.exec();
249 
250  showClient(endSessionClient);
251  assertEquals(endSessionResponse.getStatus(), 200);
252  assertNotNull(endSessionResponse.getHtmlPage());
253 
254  // silly validation of html content returned by server but at least it verifies that logout_uri and post_logout_uri are present
255  assertTrue(endSessionResponse.getHtmlPage().contains("<html>"));
256  assertTrue(endSessionResponse.getHtmlPage().contains(logoutUri));
257  assertTrue(endSessionResponse.getHtmlPage().contains(postLogoutRedirectUri));
258  // assertEquals(endSessionResponse.getState(), endSessionId); // commented out, for http-based logout we get html page
259  }
260  }
261  }
ID_TOKEN
Definition: ResponseType.java:47
String registrationEndpoint
Definition: BaseTest.java:81
Definition: RegisterClient.java:34
Definition: EndSessionResponse.java:17
String getIdToken()
Definition: AuthorizationResponse.java:295
CODE
Definition: ResponseType.java:39
void setSubjectType(SubjectType subjectType)
Definition: RegisterRequest.java:522
String getClaimAsString(String key)
Definition: JwtClaimSet.java:55
CLIENT_SECRET_BASIC
Definition: AuthenticationMethod.java:18
UserInfoResponse execUserInfo(String accessToken)
Definition: UserInfoClient.java:66
String getRegistrationClientUri()
Definition: RegisterResponse.java:181
PAIRWISE
Definition: SubjectType.java:14
String jwksUri
Definition: BaseTest.java:80
String getCode()
Definition: AuthorizationResponse.java:167
Definition: TokenClient.java:24
void setAuthUsername(String authUsername)
Definition: BaseRequest.java:62
void setFrontChannelLogoutUris(List< String > logoutUris)
Definition: RegisterRequest.java:180
String getScope()
Definition: TokenResponse.java:163
Definition: RegisterResponse.java:34
String getState()
Definition: AuthorizationResponse.java:314
void setGrantTypes(List< GrantType > grantTypes)
Definition: RegisterRequest.java:290
AuthorizationResponse exec()
Definition: AuthorizeClient.java:167
TokenType getTokenType()
Definition: TokenResponse.java:107
void setSectorIdentifierUri(String sectorIdentifierUri)
Definition: RegisterRequest.java:504
TokenResponse execRefreshToken(String scope, String refreshToken, String clientId, String clientSecret)
Definition: TokenClient.java:202
Map< String, String > getClaims()
Definition: RegisterResponse.java:237
Definition: SignatureAlgorithm.java:20
static void showClient(BaseClient client)
Definition: BaseTest.java:775
Definition: GrantType.java:23
JwtClaims getClaims()
Definition: JsonWebResponse.java:41
String tokenEndpoint
Definition: BaseTest.java:75
Definition: TokenRequest.java:34
String getHtmlPage()
Definition: EndSessionResponse.java:58
void setRedirectUri(String redirectUri)
Definition: TokenRequest.java:179
Date getClientSecretExpiresAt()
Definition: RegisterResponse.java:205
String getSessionId()
Definition: AuthorizationResponse.java:203
RegisterResponse exec()
Definition: RegisterClient.java:76
void setAuthPassword(String authPassword)
Definition: BaseRequest.java:70
Definition: AuthorizeClient.java:29
Definition: SubjectType.java:12
REFRESH_TOKEN
Definition: GrantType.java:70
Integer getExpiresIn()
Definition: TokenResponse.java:125
AUTHORIZATION_CODE
Definition: GrantType.java:33
EndSessionResponse exec()
Definition: EndSessionClient.java:66
String getAccessToken()
Definition: TokenResponse.java:89
String getClientSecret()
Definition: RegisterResponse.java:160
WEB
Definition: ApplicationType.java:28
RS256
Definition: SignatureAlgorithm.java:26
AuthorizeErrorResponseType getErrorType()
Definition: AuthorizationResponse.java:334
List< String > getClaim(String claimName)
Definition: UserInfoResponse.java:109
Definition: EndSessionRequest.java:22
Definition: TokenResponse.java:22
Definition: JwkClient.java:29
String getClientId()
Definition: RegisterResponse.java:142
TokenResponse exec()
Definition: TokenClient.java:218
void setScope(List< String > scope)
Definition: RegisterRequest.java:895
void showTitle(String title)
Definition: BaseTest.java:761
Definition: Jwt.java:24
String endSessionEndpoint
Definition: BaseTest.java:79
void setRequest(T request)
Definition: BaseClient.java:68
void setAuthenticationMethod(AuthenticationMethod authenticationMethod)
Definition: BaseRequest.java:78
Definition: AuthorizationResponse.java:32
void setResponseTypes(List< ResponseType > responseTypes)
Definition: RegisterRequest.java:272
Definition: RegisterRequest.java:37
String getScope()
Definition: AuthorizationResponse.java:277
static RSAPublicKey getRSAPublicKey(String jwkSetUri, String keyId)
Definition: JwkClient.java:94
JwtHeader getHeader()
Definition: JsonWebResponse.java:33
Definition: UserInfoClient.java:34
String userInfoEndpoint
Definition: BaseTest.java:76
TOKEN
Definition: ResponseType.java:43
void setCode(String code)
Definition: TokenRequest.java:143
List< GrantType > getGrantTypes()
Definition: RegisterResponse.java:229
String getLocation()
Definition: BaseResponse.java:58
int getStatus()
Definition: BaseResponse.java:49
Definition: AuthorizationRequest.java:33
Definition: ApplicationType.java:12
void setPostLogoutRedirectUris(List< String > postLogoutRedirectUris)
Definition: RegisterRequest.java:837
Definition: ResponseType.java:34
void setState(String state)
Definition: AuthorizationRequest.java:217
Date getClientIdIssuedAt()
Definition: RegisterResponse.java:189
Definition: EndSessionClient.java:28
String authorizationEndpoint
Definition: BaseTest.java:72
List< ResponseType > getResponseTypes()
Definition: RegisterResponse.java:221
Definition: AuthenticationMethod.java:12
static Jwt parse(String encodedJwt)
Definition: Jwt.java:54
Definition: UserInfoResponse.java:20
AuthorizationResponse authenticateResourceOwnerAndGrantAccess(String authorizeUrl, AuthorizationRequest authorizationRequest, String userId, String userSecret)
Definition: BaseTest.java:252
String getRefreshToken()
Definition: TokenResponse.java:144
String getErrorDescription()
Definition: AuthorizationResponse.java:355
String getAccessToken()
Definition: AuthorizationResponse.java:185
void setSessionId(String p_sessionId)
Definition: EndSessionRequest.java:90
String getRegistrationAccessToken()
Definition: RegisterResponse.java:173

◆ initTestSuite()

void org.xdi.oxauth.BaseTest.initTestSuite ( ITestContext  context) throws FileNotFoundException, IOException
inlineinherited
95  {
96  SecurityProviderUtility.installBCProvider();
97 
98  Reporter.log("Invoked init test suite method \n", true);
99 
100  String propertiesFile = context.getCurrentXmlTest().getParameter("propertiesFile");
101  if (StringHelper.isEmpty(propertiesFile)) {
102  propertiesFile = "target/test-classes/testng.properties";
103  //propertiesFile = "U:\\own\\project\\git\\oxAuth\\Client\\src\\test\\resources\\testng_yuriy.properties";
104  //propertiesFile = "/Users/JAVIER/IdeaProjects/oxAuth/Client/target/test-classes/testng.properties";
105  }
106 
107  FileInputStream conf = new FileInputStream(propertiesFile);
108  Properties prop = new Properties();
109  prop.load(conf);
110 
111  Map<String, String> parameters = new HashMap<String, String>();
112  for (Entry<Object, Object> entry : prop.entrySet()) {
113  Object key = entry.getKey();
114  Object value = entry.getValue();
115 
116  if (StringHelper.isEmptyString(key) || StringHelper.isEmptyString(value)) {
117  continue;
118  }
119  parameters.put(key.toString(), value.toString());
120  }
121 
122  // Overrided test paramters
123  context.getSuite().getXmlSuite().setParameters(parameters);
124  }

◆ omittedResponseTypesFailDataProvider()

Object [][] org.xdi.oxauth.ws.rs.GrantTypesRestrictionHttpTest.omittedResponseTypesFailDataProvider ( ITestContext  context)
inline
264  {
265  String userId = context.getCurrentXmlTest().getParameter("userId");
266  String userSecret = context.getCurrentXmlTest().getParameter("userSecret");
267  String redirectUris = context.getCurrentXmlTest().getParameter("redirectUris");
268  String redirectUri = context.getCurrentXmlTest().getParameter("redirectUri");
269  String sectorIdentifierUri = context.getCurrentXmlTest().getParameter("sectorIdentifierUri");
270  String postLogoutRedirectUri = context.getCurrentXmlTest().getParameter("postLogoutRedirectUri");
271  String logoutUri = context.getCurrentXmlTest().getParameter("logoutUri");
272 
273  return new Object[][]{
274  {
275  Arrays.asList(),
276  Arrays.asList(ResponseType.CODE),
277  Arrays.asList(),
279  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
280  },
281  {
282  Arrays.asList(ResponseType.CODE),
283  Arrays.asList(ResponseType.CODE),
284  Arrays.asList(),
286  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
287  },
288  {
289  Arrays.asList(ResponseType.TOKEN),
290  Arrays.asList(ResponseType.TOKEN),
291  Arrays.asList(),
292  Arrays.asList(GrantType.IMPLICIT),
293  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
294  },
295  {
296  Arrays.asList(ResponseType.ID_TOKEN),
297  Arrays.asList(ResponseType.ID_TOKEN),
298  Arrays.asList(),
299  Arrays.asList(GrantType.IMPLICIT),
300  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
301  },
302  {
303  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
304  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
305  Arrays.asList(),
306  Arrays.asList(GrantType.IMPLICIT),
307  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
308  },
309  {
310  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
311  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
312  Arrays.asList(),
314  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
315  },
316  {
317  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
318  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
319  Arrays.asList(),
321  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
322  },
323  {
326  Arrays.asList(),
328  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
329  },
330  //
331  {
332  Arrays.asList(),
333  Arrays.asList(ResponseType.CODE),
334  Arrays.asList(GrantType.AUTHORIZATION_CODE),
336  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
337  },
338  {
339  Arrays.asList(),
340  Arrays.asList(ResponseType.TOKEN),
341  Arrays.asList(GrantType.IMPLICIT),
342  Arrays.asList(GrantType.IMPLICIT),
343  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
344  },
345  {
346  Arrays.asList(),
347  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
350  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
351  },
352  {
353  Arrays.asList(),
354  Arrays.asList(),
355  Arrays.asList(GrantType.REFRESH_TOKEN),
356  Arrays.asList(GrantType.REFRESH_TOKEN),
357  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
358  },
359  {
360  Arrays.asList(),
361  Arrays.asList(),
364  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
365  },
366  {
367  Arrays.asList(),
368  Arrays.asList(),
369  Arrays.asList(GrantType.CLIENT_CREDENTIALS),
370  Arrays.asList(GrantType.CLIENT_CREDENTIALS),
371  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
372  },
373  {
374  Arrays.asList(),
375  Arrays.asList(),
376  Arrays.asList(GrantType.OXAUTH_UMA_TICKET),
377  Arrays.asList(GrantType.OXAUTH_UMA_TICKET),
378  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
379  },
380  //
381  {
382  Arrays.asList(ResponseType.CODE),
383  Arrays.asList(ResponseType.CODE),
384  Arrays.asList(GrantType.AUTHORIZATION_CODE),
386  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
387  },
388  {
389  Arrays.asList(ResponseType.CODE),
390  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
391  Arrays.asList(GrantType.IMPLICIT),
393  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
394  },
395  {
396  Arrays.asList(ResponseType.CODE),
397  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
400  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
401  },
402  {
403  Arrays.asList(ResponseType.CODE),
404  Arrays.asList(ResponseType.CODE),
405  Arrays.asList(GrantType.REFRESH_TOKEN),
407  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
408  },
409  {
410  Arrays.asList(ResponseType.CODE),
411  Arrays.asList(ResponseType.CODE),
414  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
415  },
416  {
417  Arrays.asList(ResponseType.CODE),
418  Arrays.asList(ResponseType.CODE),
419  Arrays.asList(GrantType.CLIENT_CREDENTIALS),
421  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
422  },
423  {
424  Arrays.asList(ResponseType.CODE),
425  Arrays.asList(ResponseType.CODE),
426  Arrays.asList(GrantType.OXAUTH_UMA_TICKET),
428  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
429  },
430  //
431  {
432  Arrays.asList(ResponseType.TOKEN),
433  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
434  Arrays.asList(GrantType.AUTHORIZATION_CODE),
436  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
437  },
438  {
439  Arrays.asList(ResponseType.TOKEN),
440  Arrays.asList(ResponseType.TOKEN),
441  Arrays.asList(GrantType.IMPLICIT),
442  Arrays.asList(GrantType.IMPLICIT),
443  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
444  },
445  {
446  Arrays.asList(ResponseType.TOKEN),
447  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
450  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
451  },
452  {
453  Arrays.asList(ResponseType.TOKEN),
454  Arrays.asList(ResponseType.TOKEN),
455  Arrays.asList(GrantType.REFRESH_TOKEN),
456  Arrays.asList(GrantType.IMPLICIT, GrantType.REFRESH_TOKEN),
457  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
458  },
459  {
460  Arrays.asList(ResponseType.TOKEN),
461  Arrays.asList(ResponseType.TOKEN),
464  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
465  },
466  {
467  Arrays.asList(ResponseType.TOKEN),
468  Arrays.asList(ResponseType.TOKEN),
469  Arrays.asList(GrantType.CLIENT_CREDENTIALS),
471  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
472  },
473  {
474  Arrays.asList(ResponseType.TOKEN),
475  Arrays.asList(ResponseType.TOKEN),
476  Arrays.asList(GrantType.OXAUTH_UMA_TICKET),
478  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
479  },
480  //
481  {
482  Arrays.asList(ResponseType.ID_TOKEN),
483  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
484  Arrays.asList(GrantType.AUTHORIZATION_CODE),
486  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
487  },
488  {
489  Arrays.asList(ResponseType.ID_TOKEN),
490  Arrays.asList(ResponseType.ID_TOKEN),
491  Arrays.asList(GrantType.IMPLICIT),
492  Arrays.asList(GrantType.IMPLICIT),
493  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
494  },
495  {
496  Arrays.asList(ResponseType.ID_TOKEN),
497  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
500  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
501  },
502  {
503  Arrays.asList(ResponseType.ID_TOKEN),
504  Arrays.asList(ResponseType.ID_TOKEN),
505  Arrays.asList(GrantType.REFRESH_TOKEN),
506  Arrays.asList(GrantType.IMPLICIT, GrantType.REFRESH_TOKEN),
507  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
508  },
509  {
510  Arrays.asList(ResponseType.ID_TOKEN),
511  Arrays.asList(ResponseType.ID_TOKEN),
514  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
515  },
516  {
517  Arrays.asList(ResponseType.ID_TOKEN),
518  Arrays.asList(ResponseType.ID_TOKEN),
519  Arrays.asList(GrantType.CLIENT_CREDENTIALS),
521  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
522  },
523  {
524  Arrays.asList(ResponseType.ID_TOKEN),
525  Arrays.asList(ResponseType.ID_TOKEN),
526  Arrays.asList(GrantType.OXAUTH_UMA_TICKET),
528  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
529  },
530  //
531  {
532  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
534  Arrays.asList(GrantType.AUTHORIZATION_CODE),
536  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
537  },
538  {
539  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
540  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
541  Arrays.asList(GrantType.IMPLICIT),
542  Arrays.asList(GrantType.IMPLICIT),
543  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
544  },
545  {
546  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
550  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
551  },
552  {
553  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
554  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
555  Arrays.asList(GrantType.REFRESH_TOKEN),
556  Arrays.asList(GrantType.IMPLICIT, GrantType.REFRESH_TOKEN),
557  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
558  },
559  {
560  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
561  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
564  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
565  },
566  {
567  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
568  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
569  Arrays.asList(GrantType.CLIENT_CREDENTIALS),
571  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
572  },
573  {
574  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
575  Arrays.asList(ResponseType.TOKEN, ResponseType.ID_TOKEN),
576  Arrays.asList(GrantType.OXAUTH_UMA_TICKET),
578  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
579  },
580  //
581  {
582  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
583  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
584  Arrays.asList(GrantType.AUTHORIZATION_CODE),
586  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
587  },
588  {
589  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
591  Arrays.asList(GrantType.IMPLICIT),
593  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
594  },
595  {
596  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
600  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
601  },
602  {
603  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
605  Arrays.asList(GrantType.REFRESH_TOKEN),
607  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
608  },
609  {
610  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
614  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
615  },
616  {
617  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
619  Arrays.asList(GrantType.CLIENT_CREDENTIALS),
621  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
622  },
623  {
624  Arrays.asList(ResponseType.CODE, ResponseType.ID_TOKEN),
626  Arrays.asList(GrantType.OXAUTH_UMA_TICKET),
628  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
629  },
630  //
631  {
632  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
633  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
634  Arrays.asList(GrantType.AUTHORIZATION_CODE),
636  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
637  },
638  {
639  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
640  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
641  Arrays.asList(GrantType.IMPLICIT),
643  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
644  },
645  {
646  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
647  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
650  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
651  },
652  {
653  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
654  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
655  Arrays.asList(GrantType.REFRESH_TOKEN),
657  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
658  },
659  {
660  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
661  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
664  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
665  },
666  {
667  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
668  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
669  Arrays.asList(GrantType.CLIENT_CREDENTIALS),
671  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
672  },
673  {
674  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
675  Arrays.asList(ResponseType.CODE, ResponseType.TOKEN),
676  Arrays.asList(GrantType.OXAUTH_UMA_TICKET),
678  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
679  },
680  //
681  {
684  Arrays.asList(GrantType.AUTHORIZATION_CODE),
686  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
687  },
688  {
691  Arrays.asList(GrantType.IMPLICIT),
693  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
694  },
695  {
700  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
701  },
702  {
705  Arrays.asList(GrantType.REFRESH_TOKEN),
707  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
708  },
709  {
714  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
715  },
716  {
719  Arrays.asList(GrantType.CLIENT_CREDENTIALS),
721  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
722  },
723  {
726  Arrays.asList(GrantType.OXAUTH_UMA_TICKET),
728  userId, userSecret, redirectUris, redirectUri, sectorIdentifierUri, postLogoutRedirectUri, logoutUri
729  },
730  };
731  }
ID_TOKEN
Definition: ResponseType.java:47
CODE
Definition: ResponseType.java:39
OXAUTH_UMA_TICKET
Definition: GrantType.java:77
Definition: GrantType.java:23
REFRESH_TOKEN
Definition: GrantType.java:70
AUTHORIZATION_CODE
Definition: GrantType.java:33
CLIENT_CREDENTIALS
Definition: GrantType.java:64
RESOURCE_OWNER_PASSWORD_CREDENTIALS
Definition: GrantType.java:52
TOKEN
Definition: ResponseType.java:43
Definition: ResponseType.java:34
IMPLICIT
Definition: GrantType.java:42

◆ output()

static void org.xdi.oxauth.BaseTest.output ( String  p_msg)
inlinestaticinherited
54  {
55  System.out.println(p_msg);
56  }

◆ setAuthorizationEndpoint()

void org.xdi.oxauth.BaseTest.setAuthorizationEndpoint ( String  authorizationEndpoint)
inlineinherited
138  {
140  }
String authorizationEndpoint
Definition: BaseTest.java:72

◆ setCheckSessionIFrame()

void org.xdi.oxauth.BaseTest.setCheckSessionIFrame ( String  checkSessionIFrame)
inlineinherited
170  {
172  }
String checkSessionIFrame
Definition: BaseTest.java:78

◆ setClientInfoEndpoint()

void org.xdi.oxauth.BaseTest.setClientInfoEndpoint ( String  clientInfoEndpoint)
inlineinherited
162  {
164  }
String clientInfoEndpoint
Definition: BaseTest.java:77

◆ setConfigurationEndpoint()

void org.xdi.oxauth.BaseTest.setConfigurationEndpoint ( String  configurationEndpoint)
inlineinherited
226  {
228  }
String configurationEndpoint
Definition: BaseTest.java:82

◆ setDriver()

void org.xdi.oxauth.BaseTest.setDriver ( WebDriver  driver)
inlineinherited
130  {
131  this.driver = driver;
132  }
WebDriver driver
Definition: BaseTest.java:70

◆ setEndSessionEndpoint()

void org.xdi.oxauth.BaseTest.setEndSessionEndpoint ( String  endSessionEndpoint)
inlineinherited
178  {
180  }
String endSessionEndpoint
Definition: BaseTest.java:79

◆ setIdGenEndpoint()

void org.xdi.oxauth.BaseTest.setIdGenEndpoint ( String  p_idGenEndpoint)
inlineinherited
218  {
219  idGenEndpoint = p_idGenEndpoint;
220  }
String idGenEndpoint
Definition: BaseTest.java:83

◆ setIntrospectionEndpoint()

void org.xdi.oxauth.BaseTest.setIntrospectionEndpoint ( String  p_introspectionEndpoint)
inlineinherited
202  {
203  introspectionEndpoint = p_introspectionEndpoint;
204  }
String introspectionEndpoint
Definition: BaseTest.java:84

◆ setJwksUri()

void org.xdi.oxauth.BaseTest.setJwksUri ( String  jwksUri)
inlineinherited
186  {
187  this.jwksUri = jwksUri;
188  }
String jwksUri
Definition: BaseTest.java:80

◆ setRegistrationEndpoint()

void org.xdi.oxauth.BaseTest.setRegistrationEndpoint ( String  registrationEndpoint)
inlineinherited
194  {
196  }
String registrationEndpoint
Definition: BaseTest.java:81

◆ setScopeToClaimsMapping()

void org.xdi.oxauth.BaseTest.setScopeToClaimsMapping ( Map< String, List< String >>  p_scopeToClaimsMapping)
inlineinherited
210  {
211  scopeToClaimsMapping = p_scopeToClaimsMapping;
212  }
Map< String, List< String > > scopeToClaimsMapping
Definition: BaseTest.java:85

◆ setTokenEndpoint()

void org.xdi.oxauth.BaseTest.setTokenEndpoint ( String  tokenEndpoint)
inlineinherited
146  {
148  }
String tokenEndpoint
Definition: BaseTest.java:75

◆ setUserInfoEndpoint()

void org.xdi.oxauth.BaseTest.setUserInfoEndpoint ( String  userInfoEndpoint)
inlineinherited
154  {
156  }
String userInfoEndpoint
Definition: BaseTest.java:76

◆ showClient() [1/2]

static void org.xdi.oxauth.BaseTest.showClient ( BaseClient  client)
inlinestaticinherited
775  {
776  ClientUtils.showClient(client);
777  }
Definition: ClientUtils.java:17
static void showClient(BaseClient client)
Definition: ClientUtils.java:21

◆ showClient() [2/2]

static void org.xdi.oxauth.BaseTest.showClient ( BaseClient  client,
CookieStore  cookieStore 
)
inlinestaticinherited
779  {
780  ClientUtils.showClient(client, cookieStore);
781  }
Definition: ClientUtils.java:17
static void showClient(BaseClient client)
Definition: ClientUtils.java:21

◆ showClientUserAgent()

static void org.xdi.oxauth.BaseTest.showClientUserAgent ( BaseClient  client)
inlinestaticinherited
783  {
785  }
Definition: ClientUtils.java:17
static void showClientUserAgent(BaseClient client)
Definition: ClientUtils.java:35

◆ showEntity()

void org.xdi.oxauth.BaseTest.showEntity ( String  entity)
inlineinherited
769  {
770  if (entity != null) {
771  System.out.println("Entity: " + entity.replace("\\n", "\n"));
772  }
773  }

◆ showResponse() [1/2]

void org.xdi.oxauth.BaseTest.showResponse ( String  title,
Response  response 
)
inlineinherited
30  {
31  showResponse(title, response, null);
32  }
void showResponse(String title, Response response)
Definition: BaseTest.java:30

◆ showResponse() [2/2]

static void org.xdi.oxauth.BaseTest.showResponse ( String  title,
Response  response,
Object  entity 
)
inlinestaticinherited
34  {
35  System.out.println(" ");
36  System.out.println("RESPONSE FOR: " + title);
37  System.out.println(response.getStatus());
38  for (Entry<String, List<Object>> headers : response.getHeaders().entrySet()) {
39  String headerName = headers.getKey();
40  System.out.println(headerName + ": " + headers.getValue());
41  }
42 
43  if (entity != null) {
44  System.out.println(entity.toString().replace("\\n", "\n"));
45  }
46  System.out.println(" ");
47  System.out.println("Status message: " + response.getStatus());
48  }

◆ showTitle() [1/2]

void org.xdi.oxauth.BaseTest.showTitle ( String  title)
inlineinherited
22  {
23  title = "TEST: " + title;
24 
25  System.out.println("#######################################################");
26  System.out.println(title);
27  System.out.println("#######################################################");
28  }

◆ showTitle() [2/2]

void org.xdi.oxauth.BaseTest.showTitle ( String  title)
inlineinherited
761  {
762  title = "TEST: " + title;
763 
764  System.out.println("#######################################################");
765  System.out.println(title);
766  System.out.println("#######################################################");
767  }

◆ startSelenium()

void org.xdi.oxauth.BaseTest.startSelenium ( )
inlineinherited
230  {
231  //System.setProperty("webdriver.chrome.driver", "/Users/JAVIER/tmp/chromedriver");
232  //driver = new ChromeDriver();
233 
234  //driver = new SafariDriver();
235 
236  //driver = new FirefoxDriver();
237 
238  //driver = new InternetExplorerDriver();
239 
240  driver = new HtmlUnitDriver(true);
241  }
WebDriver driver
Definition: BaseTest.java:70

◆ stopSelenium()

void org.xdi.oxauth.BaseTest.stopSelenium ( )
inlineinherited
243  {
244 // driver.close();
245  driver.quit();
246  }
WebDriver driver
Definition: BaseTest.java:70

◆ waitForResourceOwnerAndGrantLoginForm() [1/2]

String org.xdi.oxauth.BaseTest.waitForResourceOwnerAndGrantLoginForm ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest,
boolean  cleanupCookies 
)
inlineinherited

Try to open login form (via the user-agent)

617  {
618  String authorizationRequestUrl = authorizeUrl + "?" + authorizationRequest.getQueryString();
619 
620  AuthorizeClient authorizeClient = new AuthorizeClient(authorizeUrl);
621  authorizeClient.setRequest(authorizationRequest);
622 
623  System.out.println("waitForResourceOwnerAndGrantLoginForm: authorizationRequestUrl:" + authorizationRequestUrl);
624  startSelenium();
625  if (cleanupCookies) {
626  System.out.println("waitForResourceOwnerAndGrantLoginForm: Cleaning cookies");
628  }
629  driver.navigate().to(authorizationRequestUrl);
630 
631  WebElement usernameElement = driver.findElement(By.name(loginFormUsername));
632  WebElement passwordElement = driver.findElement(By.name(loginFormPassword));
633  WebElement loginButton = driver.findElement(By.name(loginFormLoginButton));
634 
635  if ((usernameElement == null) || (passwordElement == null) || (loginButton == null)) {
636  return null;
637  }
638 
639  Cookie sessionStateCookie = driver.manage().getCookieNamed("session_state");
640  String sessionState = null;
641  if (sessionStateCookie != null) {
642  sessionState = sessionStateCookie.getValue();
643  }
644  System.out.println("waitForResourceOwnerAndGrantLoginForm: sessionState:" + sessionState);
645 
646  stopSelenium();
647 
648  showClientUserAgent(authorizeClient);
649 
650  return sessionState;
651  }
String loginFormUsername
Definition: BaseTest.java:88
String loginFormPassword
Definition: BaseTest.java:89
void deleteAllCookies()
Definition: BaseTest.java:661
void stopSelenium()
Definition: BaseTest.java:243
Definition: AuthorizeClient.java:29
void startSelenium()
Definition: BaseTest.java:230
String loginFormLoginButton
Definition: BaseTest.java:90
void setRequest(T request)
Definition: BaseClient.java:68
WebDriver driver
Definition: BaseTest.java:70
String getQueryString()
Definition: AuthorizationRequest.java:486
static void showClientUserAgent(BaseClient client)
Definition: BaseTest.java:783

◆ waitForResourceOwnerAndGrantLoginForm() [2/2]

String org.xdi.oxauth.BaseTest.waitForResourceOwnerAndGrantLoginForm ( String  authorizeUrl,
AuthorizationRequest  authorizationRequest 
)
inlineinherited

Try to open login form (via the user-agent)

657  {
658  return waitForResourceOwnerAndGrantLoginForm(authorizeUrl, authorizationRequest, true);
659  }
String waitForResourceOwnerAndGrantLoginForm(String authorizeUrl, AuthorizationRequest authorizationRequest, boolean cleanupCookies)
Definition: BaseTest.java:616

メンバ詳解

◆ authorizationEndpoint

String org.xdi.oxauth.BaseTest.authorizationEndpoint
protectedinherited

◆ authorizationPageEndpoint

String org.xdi.oxauth.BaseTest.authorizationPageEndpoint
protectedinherited

◆ checkSessionIFrame

String org.xdi.oxauth.BaseTest.checkSessionIFrame
protectedinherited

◆ clientInfoEndpoint

String org.xdi.oxauth.BaseTest.clientInfoEndpoint
protectedinherited

◆ configurationEndpoint

String org.xdi.oxauth.BaseTest.configurationEndpoint
protectedinherited

◆ driver

WebDriver org.xdi.oxauth.BaseTest.driver
protectedinherited

◆ endSessionEndpoint

String org.xdi.oxauth.BaseTest.endSessionEndpoint
protectedinherited

◆ gluuConfigurationEndpoint

String org.xdi.oxauth.BaseTest.gluuConfigurationEndpoint
protectedinherited

◆ idGenEndpoint

String org.xdi.oxauth.BaseTest.idGenEndpoint
protectedinherited

◆ introspectionEndpoint

String org.xdi.oxauth.BaseTest.introspectionEndpoint
protectedinherited

◆ jwksUri

String org.xdi.oxauth.BaseTest.jwksUri
protectedinherited

◆ registrationEndpoint

String org.xdi.oxauth.BaseTest.registrationEndpoint
protectedinherited

◆ scopeToClaimsMapping

Map<String, List<String> > org.xdi.oxauth.BaseTest.scopeToClaimsMapping
protectedinherited

◆ testData

FileConfiguration org.xdi.oxauth.ConfigurableTest.testData
staticinherited

◆ tokenEndpoint

String org.xdi.oxauth.BaseTest.tokenEndpoint
protectedinherited

◆ userInfoEndpoint

String org.xdi.oxauth.BaseTest.userInfoEndpoint
protectedinherited

このクラス詳解は次のファイルから抽出されました: