Package org.sonatype.nexus.security.auth

Examples of org.sonatype.nexus.security.auth.ClientInfo


      return;
    }

    final Action action = Action.valueOf(getHttpMethodAction(request));

    final ClientInfo clientInfo =
        new ClientInfo(String.valueOf(subject.getPrincipal()),
            RemoteIPFinder.findIP((HttpServletRequest) request), "n/a");
    final ResourceInfo resInfo =
        new ResourceInfo("HTTP", ((HttpServletRequest) request).getMethod(), action,
            ((HttpServletRequest) request).getRequestURI());
View Full Code Here


  @Override
  public ClientInfo getCurrentThreadClientInfo() {
    try {
      HttpServletRequest request = httpRequestProvider.get();
      Subject subject = SecurityUtils.getSubject();
      return new ClientInfo(
          subject != null && subject.getPrincipal() != null ? subject.getPrincipal().toString() : null,
          RemoteIPFinder.findIP(request),
          request.getHeader(HttpHeaders.USER_AGENT)
      );
    }
View Full Code Here

      return;
    }

    lastNexusAuthenticationEvent = nae;

    final ClientInfo ai = nae.getClientInfo();

    final Map<String, String> data = Maps.newHashMap();
    putIfNotNull(data, "success", String.valueOf(nae.isSuccessful()));
    putIfNotNull(data, "userId", ai.getUserid());
    putIfNotNull(data, "userIp", ai.getRemoteIP());
    putIfNotNull(data, "userUa", ai.getUserAgent());
    final FeedEvent fe = new FeedEvent(
        FeedRecorder.FAMILY_AUTH,
        FeedRecorder.AUTH_AUTHC,
        nae.getEventDate(),
        null, // "system"
View Full Code Here

      // do nothing
      return;
    }
    lastNexusAuthorizationEvent = nae;

    final ClientInfo ai = nae.getClientInfo();
    final ResourceInfo ri = nae.getResourceInfo();

    final Map<String, String> data = Maps.newHashMap();
    putIfNotNull(data, "success", String.valueOf(nae.isSuccessful()));
    putIfNotNull(data, "userId", ai.getUserid());
    putIfNotNull(data, "userIp", ai.getRemoteIP());
    putIfNotNull(data, "userUa", ai.getUserAgent());
    putIfNotNull(data, "resProto", ri.getAccessProtocol());
    putIfNotNull(data, "resMethod", ri.getAccessMethod());
    putIfNotNull(data, "resAction", ri.getAction().name());
    putIfNotNull(data, "resUri", ri.getAccessedUri());
    final FeedEvent fe = new FeedEvent(
View Full Code Here

    underTest = new AuthSubscriber(feedRecorder, nexusConfiguration);
    when(nexusConfiguration.getAnonymousUsername()).thenReturn("anonymous");
  }

  public void perform(final String username, final int expected) throws Exception {
    final ClientInfo authSuccess = new ClientInfo(username, "192.168.0.1", "Foo/Bar");
    final ClientInfo authFailed = new ClientInfo(username, "192.168.0.1", "Foo/Bar");

    NexusAuthenticationEvent naeSuccess = new NexusAuthenticationEvent(this, authSuccess, true);
    NexusAuthenticationEvent naeFailed = new NexusAuthenticationEvent(this, authFailed, false);

    // we send same event 5 times, but only one of them should be recorded since the rest 4 are "similar" and within
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.security.auth.ClientInfo

Copyright © 2018 www.massapicom. 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.