@Test public void testCreateLoginUri() throws Exception { Uri loginUri = target.createLoginUrl(config, PKCE_CODE, LINE_AUTH_PARAMS, STATE, NONCE, REDIRECT_URI); assertEquals(WEB_LOGIN_PAGE_URL.getScheme(), loginUri.getScheme()); assertEquals(WEB_LOGIN_PAGE_URL.getAuthority(), loginUri.getAuthority()); assertEquals(WEB_LOGIN_PAGE_URL.getPath(), loginUri.getPath()); assertEquals(config.getChannelId(), loginUri.getQueryParameter("loginChannelId")); Uri returnUri = Uri.parse(loginUri.getQueryParameter("returnUri")); assertEquals("code", returnUri.getQueryParameter("response_type")); assertEquals(CHANNEL_ID, returnUri.getQueryParameter("client_id")); assertEquals(STATE, returnUri.getQueryParameter("state")); assertEquals(NONCE, returnUri.getQueryParameter("nonce")); assertEquals(PKCE_CODE.getChallenge(), returnUri.getQueryParameter("code_challenge")); assertEquals("S256", returnUri.getQueryParameter("code_challenge_method")); assertEquals(REDIRECT_URI, returnUri.getQueryParameter("redirect_uri")); assertEquals(BuildConfig.VERSION_NAME, returnUri.getQueryParameter("sdk_ver")); assertEquals("friends groups", returnUri.getQueryParameter("scope")); }
@VisibleForTesting @NonNull Uri createLoginUrl( @NonNull LineAuthenticationConfig config, @NonNull PKCECode pkceCode, @NonNull LineAuthenticationParams params, @NonNull String oAuthState, @Nullable String openIdNonce, @NonNull String redirectUri) { final String baseReturnUri = "/oauth2/v2.1/authorize/consent"; final Map<String, String> returnQueryParams = buildParams( "response_type", "code", "client_id", config.getChannelId(), "state", oAuthState, "code_challenge", pkceCode.getChallenge(), "code_challenge_method", CodeChallengeMethod.S256.getValue(), "redirect_uri", redirectUri, "sdk_ver", BuildConfig.VERSION_NAME, "scope", Scope.join(params.getScopes()) ); if (!TextUtils.isEmpty(openIdNonce)) { returnQueryParams.put("nonce", openIdNonce); } if (params.getBotPrompt() != null) { returnQueryParams.put("bot_prompt", params.getBotPrompt().name().toLowerCase()); } final String returnUri = appendQueryParams(baseReturnUri, returnQueryParams) .toString(); final Map<String, String> loginQueryParams = buildParams( "returnUri", returnUri, "loginChannelId", config.getChannelId() ); if (params.getUILocale() != null) { loginQueryParams.put("ui_locales", params.getUILocale().toString()); } return appendQueryParams(config.getWebLoginPageUrl(), loginQueryParams); }
BrowserAuthenticationApi { @VisibleForTesting @NonNull Uri createLoginUrl( @NonNull LineAuthenticationConfig config, @NonNull PKCECode pkceCode, @NonNull LineAuthenticationParams params, @NonNull String oAuthState, @Nullable String openIdNonce, @NonNull String redirectUri) { final String baseReturnUri = "/oauth2/v2.1/authorize/consent"; final Map<String, String> returnQueryParams = buildParams( "response_type", "code", "client_id", config.getChannelId(), "state", oAuthState, "code_challenge", pkceCode.getChallenge(), "code_challenge_method", CodeChallengeMethod.S256.getValue(), "redirect_uri", redirectUri, "sdk_ver", BuildConfig.VERSION_NAME, "scope", Scope.join(params.getScopes()) ); if (!TextUtils.isEmpty(openIdNonce)) { returnQueryParams.put("nonce", openIdNonce); } if (params.getBotPrompt() != null) { returnQueryParams.put("bot_prompt", params.getBotPrompt().name().toLowerCase()); } final String returnUri = appendQueryParams(baseReturnUri, returnQueryParams) .toString(); final Map<String, String> loginQueryParams = buildParams( "returnUri", returnUri, "loginChannelId", config.getChannelId() ); if (params.getUILocale() != null) { loginQueryParams.put("ui_locales", params.getUILocale().toString()); } return appendQueryParams(config.getWebLoginPageUrl(), loginQueryParams); } }
BrowserAuthenticationApi { @VisibleForTesting @NonNull Uri createLoginUrl( @NonNull LineAuthenticationConfig config, @NonNull PKCECode pkceCode, @NonNull LineAuthenticationParams params, @NonNull String oAuthState, @Nullable String openIdNonce, @NonNull String redirectUri) { final String baseReturnUri = "/oauth2/v2.1/authorize/consent"; final Map<String, String> returnQueryParams = buildParams( "response_type", "code", "client_id", config.getChannelId(), "state", oAuthState, "code_challenge", pkceCode.getChallenge(), "code_challenge_method", CodeChallengeMethod.S256.getValue(), "redirect_uri", redirectUri, "sdk_ver", BuildConfig.VERSION_NAME, "scope", Scope.join(params.getScopes()) ); if (!TextUtils.isEmpty(openIdNonce)) { returnQueryParams.put("nonce", openIdNonce); } if (params.getBotPrompt() != null) { returnQueryParams.put("bot_prompt", params.getBotPrompt().name().toLowerCase()); } final String returnUri = appendQueryParams(baseReturnUri, returnQueryParams) .toString(); final Map<String, String> loginQueryParams = buildParams( "returnUri", returnUri, "loginChannelId", config.getChannelId() ); if (params.getUILocale() != null) { loginQueryParams.put("ui_locales", params.getUILocale().toString()); } return appendQueryParams(config.getWebLoginPageUrl(), loginQueryParams); } BrowserAuthenticationApi(@NonNull LineAuthenticationStatus authenticationStatus); }
BrowserAuthenticationApi { @VisibleForTesting @NonNull Uri createLoginUrl( @NonNull LineAuthenticationConfig config, @NonNull PKCECode pkceCode, @NonNull LineAuthenticationParams params, @NonNull String oAuthState, @Nullable String openIdNonce, @NonNull String redirectUri) { final String baseReturnUri = "/oauth2/v2.1/authorize/consent"; final Map<String, String> returnQueryParams = buildParams( "response_type", "code", "client_id", config.getChannelId(), "state", oAuthState, "code_challenge", pkceCode.getChallenge(), "code_challenge_method", CodeChallengeMethod.S256.getValue(), "redirect_uri", redirectUri, "sdk_ver", BuildConfig.VERSION_NAME, "scope", Scope.join(params.getScopes()) ); if (!TextUtils.isEmpty(openIdNonce)) { returnQueryParams.put("nonce", openIdNonce); } if (params.getBotPrompt() != null) { returnQueryParams.put("bot_prompt", params.getBotPrompt().name().toLowerCase()); } final String returnUri = appendQueryParams(baseReturnUri, returnQueryParams) .toString(); final Map<String, String> loginQueryParams = buildParams( "returnUri", returnUri, "loginChannelId", config.getChannelId() ); if (params.getUILocale() != null) { loginQueryParams.put("ui_locales", params.getUILocale().toString()); } return appendQueryParams(config.getWebLoginPageUrl(), loginQueryParams); } BrowserAuthenticationApi(@NonNull LineAuthenticationStatus authenticationStatus);  }
BrowserAuthenticationApi { @VisibleForTesting @NonNull Uri createLoginUrl( @NonNull LineAuthenticationConfig config, @NonNull PKCECode pkceCode, @NonNull LineAuthenticationParams params, @NonNull String oAuthState, @Nullable String openIdNonce, @NonNull String redirectUri) { final String baseReturnUri = "/oauth2/v2.1/authorize/consent"; final Map<String, String> returnQueryParams = buildParams( "response_type", "code", "client_id", config.getChannelId(), "state", oAuthState, "code_challenge", pkceCode.getChallenge(), "code_challenge_method", CodeChallengeMethod.S256.getValue(), "redirect_uri", redirectUri, "sdk_ver", BuildConfig.VERSION_NAME, "scope", Scope.join(params.getScopes()) ); if (!TextUtils.isEmpty(openIdNonce)) { returnQueryParams.put("nonce", openIdNonce); } if (params.getBotPrompt() != null) { returnQueryParams.put("bot_prompt", params.getBotPrompt().name().toLowerCase()); } final String returnUri = appendQueryParams(baseReturnUri, returnQueryParams) .toString(); final Map<String, String> loginQueryParams = buildParams( "returnUri", returnUri, "loginChannelId", config.getChannelId() ); if (params.getUILocale() != null) { loginQueryParams.put("ui_locales", params.getUILocale().toString()); } return appendQueryParams(config.getWebLoginPageUrl(), loginQueryParams); } BrowserAuthenticationApi(@NonNull LineAuthenticationStatus authenticationStatus);   }