Examples of Authorization


Examples of org.apache.jmeter.protocol.http.control.Authorization

            // set the auth. thanks to KiYun Roe for contributing the patch
            // I cleaned up the patch slightly. 5-26-05
            if (getAuthManager() != null) {
                if (getAuthManager().getAuthForURL(getUrl()) != null) {
                    AuthManager authmanager = getAuthManager();
                    Authorization auth = authmanager.getAuthForURL(getUrl());
                    spconn.setUserName(auth.getUser());
                    spconn.setPassword(auth.getPass());
                } else {
                    log.warn("the URL for the auth was null." + " Username and password not set");
                }
            }
            // check the proxy
View Full Code Here

Examples of org.apache.jmeter.protocol.http.control.Authorization

     */
    private void setConnectionAuthorization(HttpClient client, URL u, AuthManager authManager) {
        HttpState state = client.getState();
        if (authManager != null) {
            HttpClientParams params = client.getParams();
            Authorization auth = authManager.getAuthForURL(u);
            if (auth != null) {
                    String username = auth.getUser();
                    String realm = auth.getRealm();
                    String domain = auth.getDomain();
                    if (log.isDebugEnabled()){
                        log.debug(username + " >  D="+ username + " D="+domain+" R="+realm);
                    }
                    state.setCredentials(
                            new AuthScope(u.getHost(),u.getPort(),
                                    realm.length()==0 ? null : realm //"" is not the same as no realm
                                    ,AuthScope.ANY_SCHEME),
                            // NT Includes other types of Credentials
                            new NTCredentials(
                                    username,
                                    auth.getPass(),
                                    localHost,
                                    domain
                            ));
                    // We have credentials - should we set pre-emptive authentication?
                    if (canSetPreEmptive){
View Full Code Here

Examples of org.apache.jmeter.protocol.http.control.Authorization

    private void setConnectionAuthorization(HttpClient client, URL url, AuthManager authManager) {
        CredentialsProvider credentialsProvider =
            ((AbstractHttpClient) client).getCredentialsProvider();
        if (authManager != null) {
            Authorization auth = authManager.getAuthForURL(url);
            if (auth != null) {
                    String username = auth.getUser();
                    String realm = auth.getRealm();
                    String domain = auth.getDomain();
                    if (log.isDebugEnabled()){
                        log.debug(username + " > D="+domain+" R="+realm);
                    }
                    credentialsProvider.setCredentials(
                            new AuthScope(url.getHost(), url.getPort(), realm.length()==0 ? null : realm),
                            new NTCredentials(username, auth.getPass(), localHost, domain));
            } else {
                credentialsProvider.clear();
            }
        } else {
            credentialsProvider.clear();           
View Full Code Here

Examples of org.apache.jmeter.protocol.http.control.Authorization

     *            the <code>AuthManager</code> containing all the cookies for
     *            this <code>UrlConfig</code>
     */
    private void setConnectionAuthorization(HttpURLConnection conn, URL u, AuthManager authManager) {
        if (authManager != null) {
            Authorization auth = authManager.getAuthForURL(u);
            if (auth != null) {
                conn.setRequestProperty(HEADER_AUTHORIZATION, auth.toBasicHeader());
            }
        }
    }
View Full Code Here

Examples of org.camunda.bpm.engine.authorization.Authorization

  }
 
  @Test
  public void testCreateGlobalAuthorization() {
   
    Authorization authorization = MockProvider.createMockGlobalAuthorization();
    when(authorizationServiceMock.createNewAuthorization(Authorization.AUTH_TYPE_GLOBAL)).thenReturn(authorization);
    when(authorizationServiceMock.saveAuthorization(authorization)).thenReturn(authorization);
     
    AuthorizationQuery authorizationQuery = mock(AuthorizationQuery.class);
    when(authorizationServiceMock.createAuthorizationQuery()).thenReturn(authorizationQuery);
    when(authorizationQuery.authorizationId(MockProvider.EXAMPLE_AUTHORIZATION_ID)).thenReturn(authorizationQuery);
    when(authorizationQuery.singleResult()).thenReturn(authorization);
   
    AuthorizationDto dto = AuthorizationDto.fromAuthorization(authorization);
   
    given()
        .body(dto).contentType(ContentType.JSON)
    .then().expect()
        .statusCode(Status.OK.getStatusCode())
    .when()
        .post(AUTH_CREATE_PATH);
   
    verify(authorizationServiceMock).createNewAuthorization(Authorization.AUTH_TYPE_GLOBAL);
    verify(authorization).setUserId(Authorization.ANY);
    verify(authorization, times(4)).setResourceType(authorization.getAuthorizationType());
    verify(authorization, times(2)).setResourceId(authorization.getResourceId());
    verify(authorization, times(2)).setPermissions(authorization.getPermissions(Permissions.values()));
    verify(authorizationServiceMock).saveAuthorization(authorization);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.authorization.Authorization

  }
 
  @Test
  public void testCreateGrantAuthorization() {

    Authorization authorization = MockProvider.createMockGrantAuthorization();
    when(authorizationServiceMock.createNewAuthorization(Authorization.AUTH_TYPE_GRANT)).thenReturn(authorization);
    when(authorizationServiceMock.saveAuthorization(authorization)).thenReturn(authorization);
     
    AuthorizationQuery authorizationQuery = mock(AuthorizationQuery.class);
    when(authorizationServiceMock.createAuthorizationQuery()).thenReturn(authorizationQuery);
    when(authorizationQuery.authorizationId(MockProvider.EXAMPLE_AUTHORIZATION_ID)).thenReturn(authorizationQuery);
    when(authorizationQuery.singleResult()).thenReturn(authorization);
   
    AuthorizationDto dto = AuthorizationDto.fromAuthorization(authorization);
   
    given()
        .body(dto).contentType(ContentType.JSON)
    .then().expect()
        .statusCode(Status.OK.getStatusCode())
    .when()
        .post(AUTH_CREATE_PATH);
   
    verify(authorizationServiceMock).createNewAuthorization(Authorization.AUTH_TYPE_GRANT);
    verify(authorization, times(2)).setUserId(authorization.getUserId());
    verify(authorization, times(4)).setResourceType(authorization.getAuthorizationType());
    verify(authorization, times(2)).setResourceId(authorization.getResourceId());
    verify(authorization, times(2)).setPermissions(authorization.getPermissions(Permissions.values()));
    verify(authorizationServiceMock).saveAuthorization(authorization);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.authorization.Authorization

  }
 
  @Test
  public void testCreateRevokeAuthorization() {

    Authorization authorization = MockProvider.createMockRevokeAuthorization();
    when(authorizationServiceMock.createNewAuthorization(Authorization.AUTH_TYPE_REVOKE)).thenReturn(authorization);
    when(authorizationServiceMock.saveAuthorization(authorization)).thenReturn(authorization);
     
    AuthorizationQuery authorizationQuery = mock(AuthorizationQuery.class);
    when(authorizationServiceMock.createAuthorizationQuery()).thenReturn(authorizationQuery);
    when(authorizationQuery.authorizationId(MockProvider.EXAMPLE_AUTHORIZATION_ID)).thenReturn(authorizationQuery);
    when(authorizationQuery.singleResult()).thenReturn(authorization);
   
    AuthorizationDto dto = AuthorizationDto.fromAuthorization(authorization);
   
    given()
        .body(dto).contentType(ContentType.JSON)
    .then().expect()
        .statusCode(Status.OK.getStatusCode())
    .when()
        .post(AUTH_CREATE_PATH);
   
    verify(authorizationServiceMock).createNewAuthorization(Authorization.AUTH_TYPE_REVOKE);
    verify(authorization, times(2)).setUserId(authorization.getUserId());
    verify(authorization, times(4)).setResourceType(authorization.getAuthorizationType());
    verify(authorization, times(2)).setResourceId(authorization.getResourceId());
    verify(authorization, times(2)).setPermissions(authorization.getPermissions(Permissions.values()));
    verify(authorizationServiceMock).saveAuthorization(authorization);
  }
View Full Code Here

Examples of org.camunda.bpm.engine.authorization.Authorization

  }
 
  @Test
  public void testDeleteAuthorization() {
   
    Authorization authorization = MockProvider.createMockGlobalAuthorization();
   
    AuthorizationQuery authorizationQuery = mock(AuthorizationQuery.class);
    when(authorizationServiceMock.createAuthorizationQuery()).thenReturn(authorizationQuery);
    when(authorizationQuery.authorizationId(MockProvider.EXAMPLE_AUTHORIZATION_ID)).thenReturn(authorizationQuery);
    when(authorizationQuery.singleResult()).thenReturn(authorization);
View Full Code Here

Examples of org.camunda.bpm.engine.authorization.Authorization

  }
 
  @Test
  public void testUpdateAuthorization() {
   
    Authorization authorization = MockProvider.createMockGlobalAuthorization();
   
    AuthorizationQuery authorizationQuery = mock(AuthorizationQuery.class);
    when(authorizationServiceMock.createAuthorizationQuery()).thenReturn(authorizationQuery);
    when(authorizationQuery.authorizationId(MockProvider.EXAMPLE_AUTHORIZATION_ID)).thenReturn(authorizationQuery);
    when(authorizationQuery.singleResult()).thenReturn(authorization);
View Full Code Here

Examples of org.camunda.bpm.engine.authorization.Authorization

  }
 
  @Test
  public void testUpdateNonExistingAuthorization() {
   
    Authorization authorization = MockProvider.createMockGlobalAuthorization();
   
    AuthorizationQuery authorizationQuery = mock(AuthorizationQuery.class);
    when(authorizationServiceMock.createAuthorizationQuery()).thenReturn(authorizationQuery);
    when(authorizationQuery.authorizationId(MockProvider.EXAMPLE_AUTHORIZATION_ID)).thenReturn(authorizationQuery);
    when(authorizationQuery.singleResult()).thenReturn(null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.