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

公開メンバ関数

void dynamicClientRegistration (final String registerPath, final String redirectUris) throws Exception
 
void requestAccessTokenCustomAuth1Step1 (final String registerPath, final String redirectUris, final String jwksUri) throws Exception
 
void requestAccessTokenCustomAuth1Step2 (final String tokenPath, final String userInum, final String userEmail) throws Exception
 
void requestAccessTokenCustomAuth2Step1 (final String registerPath, final String redirectUris, final String jwksUri) throws Exception
 
void requestAccessTokenCustomAuth2Step2 (final String tokenPath, final String userId, final String userSecret) throws Exception
 
void requestAccessTokenCustomAuth3Step1 (final String registerPath, final String redirectUris, final String jwksUri) throws Exception
 
void requestAccessTokenCustomAuth3Step2 (final String tokenPath, final String userInum, final String userEmail) throws Exception
 
void requestAccessTokenCustomAuth4Step1 (final String registerPath, final String redirectUris, final String jwksUri) throws Exception
 
void requestAccessTokenCustomAuth4Step2 (final String tokenPath, final String userId, final String userSecret, final String audience, final String keyId, final String dnName, final String keyStoreFile, final String keyStoreSecret) throws Exception
 
void requestAccessTokenCustomAuthStep1 (final String authorizePath, final String userId, final String userSecret, final String redirectUri) throws Exception
 
void requestAccessTokenCustomAuthStep2 (final String tokenPath, final String validateTokenPath, final String redirectUri) throws Exception
 
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
 

非公開変数類

URI url
 

静的非公開変数類

static String clientId
 
static String clientSecret
 
static String clientId1
 
static String clientSecret1
 
static String clientId2
 
static String clientSecret2
 
static String clientId3
 
static String clientSecret3
 
static String clientId4
 
static String clientSecret4
 
static String authorizationCode1
 

詳解

Functional tests for the Use Authentication Filter (embedded)

著者
Javier Rojas Blum
バージョン
April 26, 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

◆ dynamicClientRegistration()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.dynamicClientRegistration ( final String  registerPath,
final String  redirectUris 
) throws Exception
inline
85  {
86  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
87 
88  List<ResponseType> responseTypes = Arrays.asList(ResponseType.CODE, ResponseType.TOKEN, ResponseType.ID_TOKEN);
89 
90  RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app",
91  StringUtils.spaceSeparatedToList(redirectUris));
92  registerRequest.setResponseTypes(responseTypes);
93  registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
94 
95  List<GrantType> grantTypes = Arrays.asList(
96  GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS
97  );
98  registerRequest.setGrantTypes(grantTypes);
99 
100  String registerRequestContent = registerRequest.getJSONParameters().toString(4);
101 
102  Response response = request.post(Entity.json(registerRequestContent));
103  String entity = response.readEntity(String.class);
104 
105  showResponse("dynamicClientRegistration", response, entity);
106 
107  assertEquals(response.getStatus(), 200, "Unexpected response code. " + entity);
108  assertNotNull(entity, "Unexpected result: " + entity);
109  try {
110  final RegisterResponse registerResponse = RegisterResponse.valueOf(entity);
111  ClientTestUtil.assert_(registerResponse);
112 
113  clientId = registerResponse.getClientId();
114  clientSecret = registerResponse.getClientSecret();
115  } catch (Exception e) {
116  e.printStackTrace();
117  fail(e.getMessage() + "\nResponse was: " + entity);
118  }
119  }
static String clientSecret
Definition: UserAuthenticationFilterEmbeddedTest.java:67
void showResponse(String title, Response response)
Definition: BaseTest.java:30
static String clientId
Definition: UserAuthenticationFilterEmbeddedTest.java:66
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64

◆ 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

◆ 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  }

◆ output()

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

◆ requestAccessTokenCustomAuth1Step1()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuth1Step1 ( final String  registerPath,
final String  redirectUris,
final String  jwksUri 
) throws Exception
inline
124  {
125  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
126 
127  RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app",
128  StringUtils.spaceSeparatedToList(redirectUris));
129  registerRequest.setJwksUri(jwksUri);
130  registerRequest.setTokenEndpointAuthMethod(AuthenticationMethod.CLIENT_SECRET_POST);
131  registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
132 
133  List<GrantType> grantTypes = Arrays.asList(
134  GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS
135  );
136  registerRequest.setGrantTypes(grantTypes);
137 
138  String registerRequestContent = registerRequest.getJSONParameters().toString(4);
139 
140  Response response = request.post(Entity.json(registerRequestContent));
141  String entity = response.readEntity(String.class);
142 
143  showResponse("requestAccessTokenCustomAuth1Step1", response, entity);
144 
145  assertEquals(response.getStatus(), 200, "Unexpected response code. " + entity);
146  assertNotNull(entity, "Unexpected result: " + entity);
147  try {
148  JSONObject jsonObj = new JSONObject(entity);
149  assertTrue(jsonObj.has(RegisterResponseParam.CLIENT_ID.toString()));
150  assertTrue(jsonObj.has(CLIENT_SECRET.toString()));
151  assertTrue(jsonObj.has(REGISTRATION_ACCESS_TOKEN.toString()));
152  assertTrue(jsonObj.has(REGISTRATION_CLIENT_URI.toString()));
153  assertTrue(jsonObj.has(CLIENT_ID_ISSUED_AT.toString()));
154  assertTrue(jsonObj.has(CLIENT_SECRET_EXPIRES_AT.toString()));
155 
156  clientId1 = jsonObj.getString(RegisterResponseParam.CLIENT_ID.toString());
157  clientSecret1 = jsonObj.getString(CLIENT_SECRET.toString());
158  } catch (JSONException e) {
159  e.printStackTrace();
160  fail(e.getMessage() + "\nResponse was: " + entity);
161  }
162  }
String jwksUri
Definition: BaseTest.java:80
static String clientId1
Definition: UserAuthenticationFilterEmbeddedTest.java:69
void showResponse(String title, Response response)
Definition: BaseTest.java:30
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64
static String clientSecret1
Definition: UserAuthenticationFilterEmbeddedTest.java:70

◆ requestAccessTokenCustomAuth1Step2()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuth1Step2 ( final String  tokenPath,
final String  userInum,
final String  userEmail 
) throws Exception
inline
167  {
168  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + tokenPath).request();
169 
170  request.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
171 
172  TokenRequest tokenRequest = new TokenRequest(GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS);
173  tokenRequest.setScope("email read_stream manage_pages");
174 
175  tokenRequest.setAuthUsername(clientId1);
176  tokenRequest.setAuthPassword(clientSecret1);
177  tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST);
178  tokenRequest.addCustomParameter("mail", userEmail);
179  tokenRequest.addCustomParameter("inum", userInum);
180 
181  Response response = request
182  .post(Entity.form(new MultivaluedHashMap<String, String>(tokenRequest.getParameters())));
183  String entity = response.readEntity(String.class);
184 
185  showResponse("requestAccessTokenCustomAuth1Step2", response, entity);
186 
187  assertEquals(response.getStatus(), 200, "Unexpected response code.");
188  assertTrue(
189  response.getHeaderString("Cache-Control") != null
190  && response.getHeaderString("Cache-Control").equals("no-store"),
191  "Unexpected result: " + response.getHeaderString("Cache-Control"));
192  assertTrue(response.getHeaderString("Pragma") != null && response.getHeaderString("Pragma").equals("no-cache"),
193  "Unexpected result: " + response.getHeaderString("Pragma"));
194  assertTrue(!entity.equals(null), "Unexpected result: " + entity);
195  try {
196  JSONObject jsonObj = new JSONObject(entity);
197  assertTrue(jsonObj.has("access_token"), "Unexpected result: access_token not found");
198  assertTrue(jsonObj.has("token_type"), "Unexpected result: token_type not found");
199  assertTrue(jsonObj.has("refresh_token"), "Unexpected result: refresh_token not found");
200  assertTrue(jsonObj.has("scope"), "Unexpected result: scope not found");
201  } catch (JSONException e) {
202  e.printStackTrace();
203  fail(e.getMessage() + "\nResponse was: " + entity);
204  }
205  }
static String clientId1
Definition: UserAuthenticationFilterEmbeddedTest.java:69
void showResponse(String title, Response response)
Definition: BaseTest.java:30
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64
static String clientSecret1
Definition: UserAuthenticationFilterEmbeddedTest.java:70

◆ requestAccessTokenCustomAuth2Step1()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuth2Step1 ( final String  registerPath,
final String  redirectUris,
final String  jwksUri 
) throws Exception
inline
210  {
211 
212  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
213 
214  RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app",
215  StringUtils.spaceSeparatedToList(redirectUris));
216  registerRequest.setJwksUri(jwksUri);
217  registerRequest.setTokenEndpointAuthMethod(AuthenticationMethod.CLIENT_SECRET_POST);
218  registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
219 
220  List<GrantType> grantTypes = Arrays.asList(
221  GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS
222  );
223  registerRequest.setGrantTypes(grantTypes);
224 
225  String registerRequestContent = registerRequest.getJSONParameters().toString(4);
226 
227  Response response = request.post(Entity.json(registerRequestContent));
228  String entity = response.readEntity(String.class);
229 
230  showResponse("requestAccessTokenCustomAuth2Step1", response, entity);
231 
232  assertEquals(response.getStatus(), 200, "Unexpected response code. " + entity);
233  assertNotNull(entity, "Unexpected result: " + entity);
234  try {
235  JSONObject jsonObj = new JSONObject(entity);
236  assertTrue(jsonObj.has(RegisterResponseParam.CLIENT_ID.toString()));
237  assertTrue(jsonObj.has(CLIENT_SECRET.toString()));
238  assertTrue(jsonObj.has(REGISTRATION_ACCESS_TOKEN.toString()));
239  assertTrue(jsonObj.has(REGISTRATION_CLIENT_URI.toString()));
240  assertTrue(jsonObj.has(CLIENT_ID_ISSUED_AT.toString()));
241  assertTrue(jsonObj.has(CLIENT_SECRET_EXPIRES_AT.toString()));
242 
243  clientId2 = jsonObj.getString(RegisterResponseParam.CLIENT_ID.toString());
244  clientSecret2 = jsonObj.getString(CLIENT_SECRET.toString());
245  } catch (JSONException e) {
246  e.printStackTrace();
247  fail(e.getMessage() + "\nResponse was: " + entity);
248  }
249  }
static String clientId2
Definition: UserAuthenticationFilterEmbeddedTest.java:72
String jwksUri
Definition: BaseTest.java:80
void showResponse(String title, Response response)
Definition: BaseTest.java:30
static String clientSecret2
Definition: UserAuthenticationFilterEmbeddedTest.java:73
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64

◆ requestAccessTokenCustomAuth2Step2()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuth2Step2 ( final String  tokenPath,
final String  userId,
final String  userSecret 
) throws Exception
inline
254  {
255  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + tokenPath).request();
256 
257  request.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
258 
259  TokenRequest tokenRequest = new TokenRequest(GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS);
260  tokenRequest.setScope("email read_stream manage_pages");
261 
262  tokenRequest.setAuthUsername(clientId2);
263  tokenRequest.setAuthPassword(clientSecret2);
264  tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_POST);
265  tokenRequest.addCustomParameter("uid", userId);
266  tokenRequest.addCustomParameter("pwd", userSecret);
267 
268  Response response = request
269  .post(Entity.form(new MultivaluedHashMap<String, String>(tokenRequest.getParameters())));
270  String entity = response.readEntity(String.class);
271 
272  showResponse("requestAccessTokenCustomAuth2Step2", response, entity);
273 
274  assertEquals(response.getStatus(), 200, "Unexpected response code.");
275  assertTrue(
276  response.getHeaderString("Cache-Control") != null
277  && response.getHeaderString("Cache-Control").equals("no-store"),
278  "Unexpected result: " + response.getHeaderString("Cache-Control"));
279  assertTrue(response.getHeaderString("Pragma") != null && response.getHeaderString("Pragma").equals("no-cache"),
280  "Unexpected result: " + response.getHeaderString("Pragma"));
281  assertTrue(!entity.equals(null), "Unexpected result: " + entity);
282  try {
283  JSONObject jsonObj = new JSONObject(entity);
284  assertTrue(jsonObj.has("access_token"), "Unexpected result: access_token not found");
285  assertTrue(jsonObj.has("token_type"), "Unexpected result: token_type not found");
286  assertTrue(jsonObj.has("refresh_token"), "Unexpected result: refresh_token not found");
287  assertTrue(jsonObj.has("scope"), "Unexpected result: scope not found");
288  } catch (JSONException e) {
289  e.printStackTrace();
290  fail(e.getMessage() + "\nResponse was: " + entity);
291  }
292  }
static String clientId2
Definition: UserAuthenticationFilterEmbeddedTest.java:72
void showResponse(String title, Response response)
Definition: BaseTest.java:30
static String clientSecret2
Definition: UserAuthenticationFilterEmbeddedTest.java:73
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64

◆ requestAccessTokenCustomAuth3Step1()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuth3Step1 ( final String  registerPath,
final String  redirectUris,
final String  jwksUri 
) throws Exception
inline
297  {
298  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
299 
300  RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app",
301  StringUtils.spaceSeparatedToList(redirectUris));
302  registerRequest.setJwksUri(jwksUri);
303  registerRequest.setTokenEndpointAuthMethod(AuthenticationMethod.CLIENT_SECRET_BASIC);
304  registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
305 
306  List<GrantType> grantTypes = Arrays.asList(
307  GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS
308  );
309  registerRequest.setGrantTypes(grantTypes);
310 
311  String registerRequestContent = registerRequest.getJSONParameters().toString(4);
312 
313  Response response = request.post(Entity.json(registerRequestContent));
314  String entity = response.readEntity(String.class);
315 
316  showResponse("requestAccessTokenCustomAuth3Step1", response, entity);
317 
318  assertEquals(response.getStatus(), 200, "Unexpected response code. " + entity);
319  assertNotNull(entity, "Unexpected result: " + entity);
320  try {
321  JSONObject jsonObj = new JSONObject(entity);
322  assertTrue(jsonObj.has(RegisterResponseParam.CLIENT_ID.toString()));
323  assertTrue(jsonObj.has(CLIENT_SECRET.toString()));
324  assertTrue(jsonObj.has(REGISTRATION_ACCESS_TOKEN.toString()));
325  assertTrue(jsonObj.has(REGISTRATION_CLIENT_URI.toString()));
326  assertTrue(jsonObj.has(CLIENT_ID_ISSUED_AT.toString()));
327  assertTrue(jsonObj.has(CLIENT_SECRET_EXPIRES_AT.toString()));
328 
329  clientId3 = jsonObj.getString(RegisterResponseParam.CLIENT_ID.toString());
330  clientSecret3 = jsonObj.getString(CLIENT_SECRET.toString());
331  } catch (JSONException e) {
332  e.printStackTrace();
333  fail(e.getMessage() + "\nResponse was: " + entity);
334  }
335  }
String jwksUri
Definition: BaseTest.java:80
static String clientId3
Definition: UserAuthenticationFilterEmbeddedTest.java:75
void showResponse(String title, Response response)
Definition: BaseTest.java:30
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64
static String clientSecret3
Definition: UserAuthenticationFilterEmbeddedTest.java:76

◆ requestAccessTokenCustomAuth3Step2()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuth3Step2 ( final String  tokenPath,
final String  userInum,
final String  userEmail 
) throws Exception
inline
340  {
341  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + tokenPath).request();
342 
343  TokenRequest tokenRequest = new TokenRequest(GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS);
344  tokenRequest.setScope("email read_stream manage_pages");
345 
346  tokenRequest.setAuthUsername(clientId3);
347  tokenRequest.setAuthPassword(clientSecret3);
348  tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_BASIC);
349  tokenRequest.addCustomParameter("mail", userEmail);
350  tokenRequest.addCustomParameter("inum", userInum);
351 
352  request.header("Authorization", "Basic " + tokenRequest.getEncodedCredentials());
353  request.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
354  Response response = request
355  .post(Entity.form(new MultivaluedHashMap<String, String>(tokenRequest.getParameters())));
356  String entity = response.readEntity(String.class);
357 
358  showResponse("requestAccessTokenCustomAuth3Step2", response, entity);
359 
360  assertEquals(response.getStatus(), 200, "Unexpected response code.");
361  assertTrue(
362  response.getHeaderString("Cache-Control") != null
363  && response.getHeaderString("Cache-Control").equals("no-store"),
364  "Unexpected result: " + response.getHeaderString("Cache-Control"));
365  assertTrue(response.getHeaderString("Pragma") != null && response.getHeaderString("Pragma").equals("no-cache"),
366  "Unexpected result: " + response.getHeaderString("Pragma"));
367  assertTrue(!entity.equals(null), "Unexpected result: " + entity);
368  try {
369  JSONObject jsonObj = new JSONObject(entity);
370  assertTrue(jsonObj.has("access_token"), "Unexpected result: access_token not found");
371  assertTrue(jsonObj.has("token_type"), "Unexpected result: token_type not found");
372  assertTrue(jsonObj.has("refresh_token"), "Unexpected result: refresh_token not found");
373  assertTrue(jsonObj.has("scope"), "Unexpected result: scope not found");
374  } catch (JSONException e) {
375  e.printStackTrace();
376  fail(e.getMessage() + "\nResponse was: " + entity);
377  }
378  }
static String clientId3
Definition: UserAuthenticationFilterEmbeddedTest.java:75
void showResponse(String title, Response response)
Definition: BaseTest.java:30
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64
static String clientSecret3
Definition: UserAuthenticationFilterEmbeddedTest.java:76

◆ requestAccessTokenCustomAuth4Step1()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuth4Step1 ( final String  registerPath,
final String  redirectUris,
final String  jwksUri 
) throws Exception
inline
383  {
384  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
385 
386  RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app",
387  StringUtils.spaceSeparatedToList(redirectUris));
388  registerRequest.setJwksUri(jwksUri);
389  registerRequest.setTokenEndpointAuthMethod(AuthenticationMethod.CLIENT_SECRET_JWT);
390  registerRequest.addCustomAttribute("oxAuthTrustedClient", "true");
391 
392  List<GrantType> grantTypes = Arrays.asList(
393  GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS
394  );
395  registerRequest.setGrantTypes(grantTypes);
396 
397  String registerRequestContent = registerRequest.getJSONParameters().toString(4);
398 
399  Response response = request.post(Entity.json(registerRequestContent));
400  String entity = response.readEntity(String.class);
401 
402  showResponse("requestAccessTokenCustomAuth4Step1", response, entity);
403 
404  assertEquals(response.getStatus(), 200, "Unexpected response code. " + entity);
405  assertNotNull(entity, "Unexpected result: " + entity);
406  try {
407  JSONObject jsonObj = new JSONObject(entity);
408  assertTrue(jsonObj.has(RegisterResponseParam.CLIENT_ID.toString()));
409  assertTrue(jsonObj.has(CLIENT_SECRET.toString()));
410  assertTrue(jsonObj.has(REGISTRATION_ACCESS_TOKEN.toString()));
411  assertTrue(jsonObj.has(REGISTRATION_CLIENT_URI.toString()));
412  assertTrue(jsonObj.has(CLIENT_ID_ISSUED_AT.toString()));
413  assertTrue(jsonObj.has(CLIENT_SECRET_EXPIRES_AT.toString()));
414 
415  clientId4 = jsonObj.getString(RegisterResponseParam.CLIENT_ID.toString());
416  clientSecret4 = jsonObj.getString(CLIENT_SECRET.toString());
417  } catch (JSONException e) {
418  e.printStackTrace();
419  fail(e.getMessage() + "\nResponse was: " + entity);
420  }
421  }
String jwksUri
Definition: BaseTest.java:80
static String clientSecret4
Definition: UserAuthenticationFilterEmbeddedTest.java:79
static String clientId4
Definition: UserAuthenticationFilterEmbeddedTest.java:78
void showResponse(String title, Response response)
Definition: BaseTest.java:30
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64

◆ requestAccessTokenCustomAuth4Step2()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuth4Step2 ( final String  tokenPath,
final String  userId,
final String  userSecret,
final String  audience,
final String  keyId,
final String  dnName,
final String  keyStoreFile,
final String  keyStoreSecret 
) throws Exception
inline
428  {
429  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + tokenPath).request();
430 
431  request.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
432 
433  OxAuthCryptoProvider cryptoProvider = new OxAuthCryptoProvider(keyStoreFile, keyStoreSecret, dnName);
434 
435  TokenRequest tokenRequest = new TokenRequest(GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS);
436  tokenRequest.setScope("email read_stream manage_pages");
437 
438  tokenRequest.setAuthUsername(clientId4);
439  tokenRequest.setAuthPassword(clientSecret4);
440  tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_JWT);
441  tokenRequest.setCryptoProvider(cryptoProvider);
442  tokenRequest.setKeyId(keyId);
443  tokenRequest.setAudience(audience);
444  tokenRequest.addCustomParameter("uid", userId);
445  tokenRequest.addCustomParameter("pwd", userSecret);
446 
447  Response response = request
448  .post(Entity.form(new MultivaluedHashMap<String, String>(tokenRequest.getParameters())));
449  String entity = response.readEntity(String.class);
450 
451  showResponse("requestAccessTokenCustomAuth4Step2", response, entity);
452 
453  assertEquals(response.getStatus(), 200, "Unexpected response code.");
454  assertTrue(
455  response.getHeaderString("Cache-Control") != null
456  && response.getHeaderString("Cache-Control").equals("no-store"),
457  "Unexpected result: " + response.getHeaderString("Cache-Control"));
458  assertTrue(response.getHeaderString("Pragma") != null && response.getHeaderString("Pragma").equals("no-cache"),
459  "Unexpected result: " + response.getHeaderString("Pragma"));
460  assertTrue(!entity.equals(null), "Unexpected result: " + entity);
461  try {
462  JSONObject jsonObj = new JSONObject(entity);
463  assertTrue(jsonObj.has("access_token"), "Unexpected result: access_token not found");
464  assertTrue(jsonObj.has("token_type"), "Unexpected result: token_type not found");
465  assertTrue(jsonObj.has("refresh_token"), "Unexpected result: refresh_token not found");
466  assertTrue(jsonObj.has("scope"), "Unexpected result: scope not found");
467  } catch (Exception e) {
468  fail(e.getMessage(), e);
469  }
470  }
static String clientSecret4
Definition: UserAuthenticationFilterEmbeddedTest.java:79
static String clientId4
Definition: UserAuthenticationFilterEmbeddedTest.java:78
void showResponse(String title, Response response)
Definition: BaseTest.java:30
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64

◆ requestAccessTokenCustomAuthStep1()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuthStep1 ( final String  authorizePath,
final String  userId,
final String  userSecret,
final String  redirectUri 
) throws Exception
inline
475  {
476  final String state = UUID.randomUUID().toString();
477 
478  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + authorizePath).request();
479 
480  request.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
481 
482  List<ResponseType> responseTypes = new ArrayList<ResponseType>();
483  responseTypes.add(ResponseType.CODE);
484  List<String> scopes = Arrays.asList("openid", "profile", "address", "email");
485 
486  AuthorizationRequest authorizationRequest = new AuthorizationRequest(responseTypes, clientId, scopes,
487  redirectUri, null);
488  authorizationRequest.setState(state);
489  authorizationRequest.getPrompts().add(Prompt.NONE);
490  authorizationRequest.addCustomParameter("uid", userId);
491  authorizationRequest.addCustomParameter("pwd", userSecret);
492 
493  Response response = request
494  .post(Entity.form(new MultivaluedHashMap<String, String>(authorizationRequest.getParameters())));
495  String entity = response.readEntity(String.class);
496 
497  showResponse("requestAccessTokenCustomAuthStep1", response, entity);
498 
499  assertEquals(response.getStatus(), 302, "Unexpected response code.");
500  assertNotNull(response.getLocation(), "Unexpected result: " + response.getLocation());
501 
502  if (response.getLocation() != null) {
503  try {
504  URI uri = new URI(response.getLocation().toString());
505  assertNotNull(uri.getQuery(), "The query string is null");
506 
507  Map<String, String> params = QueryStringDecoder.decode(uri.getQuery());
508 
509  assertNotNull(params.get(AuthorizeResponseParam.CODE), "The code is null");
510  assertNotNull(params.get(AuthorizeResponseParam.SCOPE), "The scope is null");
511  assertNotNull(params.get(AuthorizeResponseParam.STATE), "The state is null");
512  assertEquals(params.get(AuthorizeResponseParam.STATE), state);
513 
514  authorizationCode1 = params.get(AuthorizeResponseParam.CODE);
515  } catch (URISyntaxException e) {
516  e.printStackTrace();
517  fail("Response URI is not well formed");
518  } catch (Exception e) {
519  e.printStackTrace();
520  fail(e.getMessage());
521  }
522  }
523  }
void showResponse(String title, Response response)
Definition: BaseTest.java:30
static String authorizationCode1
Definition: UserAuthenticationFilterEmbeddedTest.java:81
static String clientId
Definition: UserAuthenticationFilterEmbeddedTest.java:66
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64

◆ requestAccessTokenCustomAuthStep2()

void org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.requestAccessTokenCustomAuthStep2 ( final String  tokenPath,
final String  validateTokenPath,
final String  redirectUri 
) throws Exception
inline
528  {
529  Builder request = ResteasyClientBuilder.newClient().target(url.toString() + tokenPath).request();
530 
531  TokenRequest tokenRequest = new TokenRequest(GrantType.AUTHORIZATION_CODE);
532  tokenRequest.setCode(authorizationCode1);
533  tokenRequest.setRedirectUri(redirectUri);
534  tokenRequest.setAuthUsername(clientId);
535  tokenRequest.setAuthPassword(clientSecret);
536 
537  request.header("Authorization", "Basic " + tokenRequest.getEncodedCredentials());
538  request.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
539 
540  Response response = request
541  .post(Entity.form(new MultivaluedHashMap<String, String>(tokenRequest.getParameters())));
542  String entity = response.readEntity(String.class);
543 
544  showResponse("requestAccessTokenCustomAuthStep2", response, entity);
545 
546  assertEquals(response.getStatus(), 200, "Unexpected response code.");
547  assertTrue(
548  response.getHeaderString("Cache-Control") != null
549  && response.getHeaderString("Cache-Control").equals("no-store"),
550  "Unexpected result: " + response.getHeaderString("Cache-Control"));
551  assertTrue(response.getHeaderString("Pragma") != null && response.getHeaderString("Pragma").equals("no-cache"),
552  "Unexpected result: " + response.getHeaderString("Pragma"));
553  assertNotNull(entity, "Unexpected result: " + entity);
554  try {
555  JSONObject jsonObj = new JSONObject(entity);
556  assertTrue(jsonObj.has("access_token"), "Unexpected result: access_token not found");
557  assertTrue(jsonObj.has("token_type"), "Unexpected result: token_type not found");
558  assertTrue(jsonObj.has("refresh_token"), "Unexpected result: refresh_token not found");
559  assertTrue(jsonObj.has("id_token"), "Unexpected result: id_token not found");
560 
561  String accessToken = jsonObj.getString("access_token");
562  String refreshToken = jsonObj.getString("refresh_token");
563  } catch (JSONException e) {
564  e.printStackTrace();
565  fail(e.getMessage() + "\nResponse was: " + entity);
566  } catch (Exception e) {
567  e.printStackTrace();
568  fail(e.getMessage());
569  }
570  }
static String clientSecret
Definition: UserAuthenticationFilterEmbeddedTest.java:67
void showResponse(String title, Response response)
Definition: BaseTest.java:30
static String authorizationCode1
Definition: UserAuthenticationFilterEmbeddedTest.java:81
static String clientId
Definition: UserAuthenticationFilterEmbeddedTest.java:66
URI url
Definition: UserAuthenticationFilterEmbeddedTest.java:64

◆ 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

メンバ詳解

◆ authorizationCode1

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.authorizationCode1
staticprivate

◆ authorizationEndpoint

String org.xdi.oxauth.BaseTest.authorizationEndpoint
protectedinherited

◆ authorizationPageEndpoint

String org.xdi.oxauth.BaseTest.authorizationPageEndpoint
protectedinherited

◆ checkSessionIFrame

String org.xdi.oxauth.BaseTest.checkSessionIFrame
protectedinherited

◆ clientId

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientId
staticprivate

◆ clientId1

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientId1
staticprivate

◆ clientId2

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientId2
staticprivate

◆ clientId3

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientId3
staticprivate

◆ clientId4

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientId4
staticprivate

◆ clientInfoEndpoint

String org.xdi.oxauth.BaseTest.clientInfoEndpoint
protectedinherited

◆ clientSecret

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientSecret
staticprivate

◆ clientSecret1

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientSecret1
staticprivate

◆ clientSecret2

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientSecret2
staticprivate

◆ clientSecret3

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientSecret3
staticprivate

◆ clientSecret4

String org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.clientSecret4
staticprivate

◆ 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

◆ url

URI org.xdi.oxauth.ws.rs.UserAuthenticationFilterEmbeddedTest.url
private

◆ userInfoEndpoint

String org.xdi.oxauth.BaseTest.userInfoEndpoint
protectedinherited

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