• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AuthenticationRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: shouldSetRealm

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldSetRealm() throws Exception {
    HttpUrl url = HttpUrl.parse(mockAPI.getDomain())
            .newBuilder()
            .addPathSegment(OAUTH_PATH)
            .addPathSegment(TOKEN_PATH)
            .build();
    AuthenticationRequest req = createRequest(url);
    mockAPI.willReturnSuccessfulLogin();
    req.setRealm("users")
            .execute();

    final RecordedRequest request = mockAPI.takeRequest();
    Map<String, String> body = bodyFromRequest(request);
    assertThat(body, hasEntry("realm", "users"));
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:17,代码来源:BaseAuthenticationRequestTest.java


示例2: shouldWhiteListOAuth2ParametersOnLegacyEndpoints

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldWhiteListOAuth2ParametersOnLegacyEndpoints() throws Exception {
    HashMap<String, Object> parameters = new HashMap<>();
    parameters.put("extra", "value");
    parameters.put("realm", "users");
    HttpUrl url = HttpUrl.parse(mockAPI.getDomain())
            .newBuilder()
            .addPathSegment(OAUTH_PATH)
            .addPathSegment(RESOURCE_OWNER_PATH)
            .build();
    AuthenticationRequest req = createRequest(url);
    mockAPI.willReturnSuccessfulLogin();
    req.addAuthenticationParameters(parameters)
            .execute();

    final RecordedRequest request = mockAPI.takeRequest();
    Map<String, String> body = bodyFromRequest(request);
    assertThat(body, hasEntry("extra", "value"));
    assertThat(body, not(hasKey("realm")));
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:21,代码来源:BaseAuthenticationRequestTest.java


示例3: shouldWhiteListLegacyParametersOnNonLegacyEndpoints

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldWhiteListLegacyParametersOnNonLegacyEndpoints() throws Exception {
    HashMap<String, Object> parameters = new HashMap<>();
    parameters.put("extra", "value");
    parameters.put("connection", "my-connection");
    HttpUrl url = HttpUrl.parse(mockAPI.getDomain())
            .newBuilder()
            .addPathSegment(OAUTH_PATH)
            .addPathSegment(TOKEN_PATH)
            .build();
    AuthenticationRequest req = createRequest(url);
    mockAPI.willReturnSuccessfulLogin();
    req.addAuthenticationParameters(parameters)
            .execute();

    final RecordedRequest request = mockAPI.takeRequest();
    Map<String, String> body = bodyFromRequest(request);
    assertThat(body, hasEntry("extra", "value"));
    assertThat(body, not(hasKey("connection")));
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:21,代码来源:BaseAuthenticationRequestTest.java


示例4: onDatabaseAuthenticationRequest

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@SuppressWarnings("unused")
@Subscribe
public void onDatabaseAuthenticationRequest(DatabaseLoginEvent event) {
    if (configuration.getDatabaseConnection() == null) {
        Log.w(TAG, "There is no default Database connection to authenticate with");
        return;
    }

    lockView.showProgress(true);
    lastDatabaseLogin = event;
    AuthenticationAPIClient apiClient = options.getAuthenticationAPIClient();
    final HashMap<String, Object> parameters = new HashMap<>(options.getAuthenticationParameters());
    if (event.getVerificationCode() != null) {
        parameters.put(KEY_VERIFICATION_CODE, event.getVerificationCode());
    }
    final String connection = configuration.getDatabaseConnection().getName();
    AuthenticationRequest request = apiClient.login(event.getUsernameOrEmail(), event.getPassword(), connection)
            .addAuthenticationParameters(parameters);
    if (options.getScope() != null) {
        request.setScope(options.getScope());
    }
    if (options.getAudience() != null && options.getAccount().isOIDCConformant()) {
        request.setAudience(options.getAudience());
    }
    request.start(authCallback);
}
 
开发者ID:auth0,项目名称:Lock.Android,代码行数:27,代码来源:LockActivity.java


示例5: setConnection

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
/**
 * Sets the 'connection' parameter.
 *
 * @param connection name of the connection
 * @return itself
 */
@Override
public AuthenticationRequest setConnection(String connection) {
    if (!hasLegacyPath()) {
        Log.w(TAG, "Not setting the 'connection' parameter as the request is using a OAuth 2.0 API Authorization endpoint that doesn't support it.");
        return this;
    }
    addParameter(CONNECTION_KEY, connection);
    return this;
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:16,代码来源:BaseAuthenticationRequest.java


示例6: setRealm

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
/**
 * Sets the 'realm' parameter. A realm identifies the host against which the authentication will be made, and usually helps to know which username and password to use.
 *
 * @param realm name of the realm
 * @return itself
 */
@Override
public AuthenticationRequest setRealm(String realm) {
    if (hasLegacyPath()) {
        Log.w(TAG, "Not setting the 'realm' parameter as the request is using a Legacy Authorization API endpoint that doesn't support it.");
        return this;
    }
    addParameter(REALM_KEY, realm);
    return this;
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:16,代码来源:BaseAuthenticationRequest.java


示例7: addAuthenticationParameters

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Override
public AuthenticationRequest addAuthenticationParameters(Map<String, Object> parameters) {
    final HashMap<String, Object> params = new HashMap<>(parameters);
    if (parameters.containsKey(CONNECTION_KEY)) {
        setConnection((String) params.remove(CONNECTION_KEY));
    }
    if (parameters.containsKey(REALM_KEY)) {
        setRealm((String) params.remove(REALM_KEY));
    }
    addParameters(params);
    return this;
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:13,代码来源:BaseAuthenticationRequest.java


示例8: loginWithToken

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
private AuthenticationRequest loginWithToken(Map<String, Object> parameters) {
    HttpUrl url = HttpUrl.parse(auth0.getDomainUrl()).newBuilder()
            .addPathSegment(OAUTH_PATH)
            .addPathSegment(TOKEN_PATH)
            .build();

    final Map<String, Object> requestParameters = ParameterBuilder.newBuilder()
            .setClientId(getClientId())
            .addAll(parameters)
            .asDictionary();
    return factory.authenticationPOST(url, client, gson)
            .addAuthenticationParameters(requestParameters);
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:14,代码来源:AuthenticationAPIClient.java


示例9: loginWithResourceOwner

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
private AuthenticationRequest loginWithResourceOwner(Map<String, Object> parameters) {
    HttpUrl url = HttpUrl.parse(auth0.getDomainUrl()).newBuilder()
            .addPathSegment(OAUTH_PATH)
            .addPathSegment(RESOURCE_OWNER_PATH)
            .build();

    final Map<String, Object> requestParameters = ParameterBuilder.newBuilder()
            .setClientId(getClientId())
            .addAll(parameters)
            .asDictionary();
    return factory.authenticationPOST(url, client, gson)
            .addAuthenticationParameters(requestParameters);
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:14,代码来源:AuthenticationAPIClient.java


示例10: shouldNotSetConnectionOnNonLegacyEndpoints

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldNotSetConnectionOnNonLegacyEndpoints() throws Exception {
    exception.expect(IllegalArgumentException.class);
    exception.expectMessage("method POST must have a request body.");
    //no body was sent

    HttpUrl url = HttpUrl.parse(mockAPI.getDomain())
            .newBuilder()
            .addPathSegment(OAUTH_PATH)
            .addPathSegment(TOKEN_PATH)
            .build();
    AuthenticationRequest req = createRequest(url);
    req.setConnection("my-connection")
            .execute();
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:16,代码来源:BaseAuthenticationRequestTest.java


示例11: shouldSetAudience

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldSetAudience() throws Exception {
    final AuthenticationRequest req = signUpRequest.setAudience("https://domain.auth0.com/api");
    verify(authenticationMockRequest).setAudience("https://domain.auth0.com/api");
    Assert.assertThat(req, is(notNullValue()));
    Assert.assertThat(req, Matchers.<AuthenticationRequest>is(signUpRequest));
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:8,代码来源:SignUpRequestTest.java


示例12: shouldSetDevice

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldSetDevice() throws Exception {
    final AuthenticationRequest req = signUpRequest.setDevice("nexus-5x");
    verify(authenticationMockRequest).setDevice("nexus-5x");
    Assert.assertThat(req, is(notNullValue()));
    Assert.assertThat(req, Matchers.<AuthenticationRequest>is(signUpRequest));
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:8,代码来源:SignUpRequestTest.java


示例13: shouldSetGrantType

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldSetGrantType() throws Exception {
    final AuthenticationRequest req = signUpRequest.setGrantType("token");
    verify(authenticationMockRequest).setGrantType("token");
    Assert.assertThat(req, is(notNullValue()));
    Assert.assertThat(req, Matchers.<AuthenticationRequest>is(signUpRequest));
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:8,代码来源:SignUpRequestTest.java


示例14: shouldSetAccessToken

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldSetAccessToken() throws Exception {
    final AuthenticationRequest req = signUpRequest.setAccessToken("super-access-token");
    verify(authenticationMockRequest).setAccessToken("super-access-token");
    Assert.assertThat(req, is(notNullValue()));
    Assert.assertThat(req, Matchers.<AuthenticationRequest>is(signUpRequest));
}
 
开发者ID:auth0,项目名称:Auth0.Android,代码行数:8,代码来源:SignUpRequestTest.java


示例15: shouldYieldCredentialsForRequest

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
private void shouldYieldCredentialsForRequest(AuthenticationRequest request, final Credentials credentials) {
    doAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            //noinspection unchecked
            BaseCallback<Credentials, AuthenticationException> callback = (BaseCallback<Credentials, AuthenticationException>) invocation.getArguments()[0];
            callback.onSuccess(credentials);
            return null;
        }
    }).when(request).start(Matchers.<BaseCallback<Credentials, AuthenticationException>>any());
}
 
开发者ID:auth0,项目名称:Lock-Facebook.Android,代码行数:12,代码来源:FacebookAuthProviderTest.java


示例16: shouldFailRequest

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
private void shouldFailRequest(AuthenticationRequest request) {
    doAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            //noinspection unchecked
            BaseCallback<Credentials, AuthenticationException> callback = (BaseCallback<Credentials, AuthenticationException>) invocation.getArguments()[0];
            callback.onFailure(new AuthenticationException("error"));
            return null;
        }
    }).when(request).start(Matchers.<BaseCallback<Credentials, AuthenticationException>>any());
}
 
开发者ID:auth0,项目名称:Lock-Facebook.Android,代码行数:12,代码来源:FacebookAuthProviderTest.java


示例17: onPasswordlessAuthenticationRequest

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@SuppressWarnings("unused")
@Subscribe
public void onPasswordlessAuthenticationRequest(PasswordlessLoginEvent event) {
    if (configuration.getPasswordlessConnection() == null) {
        Log.w(TAG, "There is no default Passwordless strategy to authenticate with");
        return;
    }

    lockView.showProgress(true);
    AuthenticationAPIClient apiClient = options.getAuthenticationAPIClient();
    String connectionName = configuration.getPasswordlessConnection().getName();
    if (event.getCode() != null) {
        AuthenticationRequest request = event.getLoginRequest(apiClient, lastPasswordlessIdentity)
                .addAuthenticationParameters(options.getAuthenticationParameters())
                .setConnection(connectionName);
        if (options.getScope() != null) {
            request.setScope(options.getScope());
        }
        request.start(authCallback);
        return;
    }

    lastPasswordlessIdentity = event.getEmailOrNumber();
    lastPasswordlessCountry = event.getCountry();
    event.getCodeRequest(apiClient, connectionName)
            .start(passwordlessCodeCallback);
}
 
开发者ID:auth0,项目名称:Lock.Android,代码行数:28,代码来源:PasswordlessLockActivity.java


示例18: getLoginRequest

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
/**
 * Creates the AuthenticationRequest that will finish the Passwordless Authentication flow.
 *
 * @param apiClient     the API Client instance
 * @param emailOrNumber the email or phone number used on the code request.
 * @return the Passwordless login request.
 */
public AuthenticationRequest getLoginRequest(AuthenticationAPIClient apiClient, String emailOrNumber) {
    Log.d(TAG, String.format("Generating Passwordless Login request for identity %s", emailOrNumber));
    if (getMode() == PasswordlessMode.EMAIL_CODE || getMode() == PasswordlessMode.EMAIL_LINK) {
        return apiClient.loginWithEmail(emailOrNumber, getCode());
    } else {
        return apiClient.loginWithPhoneNumber(emailOrNumber, getCode());
    }
}
 
开发者ID:auth0,项目名称:Lock.Android,代码行数:16,代码来源:PasswordlessLoginEvent.java


示例19: shouldGetValidLoginRequestWhenUsingEmailAndCode

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldGetValidLoginRequestWhenUsingEmailAndCode() throws Exception {
    AuthenticationAPIClient client = mock(AuthenticationAPIClient.class);
    AuthenticationRequest authRequest = mock(AuthenticationRequest.class);
    when(client.loginWithEmail(EMAIL, CODE)).thenReturn(authRequest);

    PasswordlessLoginEvent emailCodeEvent = PasswordlessLoginEvent.submitCode(PasswordlessMode.EMAIL_CODE, CODE);
    AuthenticationRequest resultRequest = emailCodeEvent.getLoginRequest(client, EMAIL);

    Assert.assertThat(resultRequest, notNullValue());
    Assert.assertThat(resultRequest, equalTo(authRequest));
}
 
开发者ID:auth0,项目名称:Lock.Android,代码行数:13,代码来源:PasswordlessLoginEventTest.java


示例20: shouldGetValidLoginRequestWhenUsingEmailAndLink

import com.auth0.android.request.AuthenticationRequest; //导入依赖的package包/类
@Test
public void shouldGetValidLoginRequestWhenUsingEmailAndLink() throws Exception {
    AuthenticationAPIClient client = mock(AuthenticationAPIClient.class);
    AuthenticationRequest authRequest = mock(AuthenticationRequest.class);
    when(client.loginWithEmail(EMAIL, CODE)).thenReturn(authRequest);

    PasswordlessLoginEvent emailCodeEvent = PasswordlessLoginEvent.submitCode(PasswordlessMode.EMAIL_LINK, CODE);
    AuthenticationRequest resultRequest = emailCodeEvent.getLoginRequest(client, EMAIL);

    Assert.assertThat(resultRequest, notNullValue());
    Assert.assertThat(resultRequest, equalTo(authRequest));
}
 
开发者ID:auth0,项目名称:Lock.Android,代码行数:13,代码来源:PasswordlessLoginEventTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GrammarBuilder类代码示例发布时间:2022-05-15
下一篇:
Java KeyAnyValue类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap