Package javax.security.auth

Examples of javax.security.auth.Subject


               
        final String baseUsername = getBaseUsername(username);

      if (onlyallowPassthrough) {
            for (String domain:getDomainsForUser(domains, username)) {
            Subject existing = this.securityHelper.getSubjectInContext(domain);
            if (existing != null) {
          this.userName = getUserName(existing)+AT+domain;
          this.securitydomain = domain;    
          this.loginContext = createLoginContext(domain, existing);
          return;
View Full Code Here


    public Object getSecurityContext() {
      Object sc = null;
        if (this.loginContext != null) {
          sc = this.securityHelper.getSecurityContext(this.securitydomain);
          if ( sc == null){
            Subject subject = this.loginContext.getSubject();
            Principal principal = null;
            for(Principal p:subject.getPrincipals()) {
              if (this.userName.startsWith(p.getName())) {
                principal = p;
                break;
              }
            }
View Full Code Here

    String requestSAMLAssertionPartName=_config.getAttribute(REQUEST_SAML_PART_NAME);

    if (requestSAMLAssertionPartName != null) {
     
      // Check if PicketLink SAML creditial is available
      Subject subject = Subject.getSubject(AccessController.getContext());
     
      if (subject != null) {
        org.picketlink.identity.federation.core.wstrust.SamlCredential samlCred=null;
       
        for (Object cred : subject.getPublicCredentials()) {
          if (cred instanceof org.picketlink.identity.federation.core.wstrust.SamlCredential) {
            samlCred = (org.picketlink.identity.federation.core.wstrust.SamlCredential)cred;
            break;
          }
        }
View Full Code Here

{
  public DisplaySubjectAction(final ConfigTree config) {}

  public Message process(final Message message) throws Exception
  {
    Subject subject = Subject.getSubject(AccessController.getContext());
    System.out.println("Subject in MyListenerAction : " + subject);
    return message;
  }
View Full Code Here

      loginContext.login();
    } catch (LoginException e) {
      throw new RuntimeException(e);
    }
    assertTrue(true); //made it till here
    Subject subject = loginContext.getSubject();
    Subject.doAsPrivileged(subject, new PrivilegedAction<Object>() {

      public Object run() {
        AccessController.checkPermission(new GVSImpersonatePermission(new SourceImpl(userSourceURL)));
        return null;
View Full Code Here

   *
   */
  public void notYetTestChangeUser() {
    final boolean[] exceptionCatched = new boolean[1];
    final Store store = new MemoryStoreImpl();
    Subject subject = new Subject();
    System.setSecurityManager(new SecurityManager());
    try {
      Subject.doAsPrivileged(subject, new PrivilegedExceptionAction() {
        public Object run() throws Exception {
          Source source = new SourceImpl("http://example.org/graph-source");
          Subject subject2 = new Subject();
          try {
            Subject.doAsPrivileged(null, new PrivilegedExceptionAction() {
              public Object run() throws Exception {
                Source source = new SourceImpl("http://example.org/graph-source");
                try {
View Full Code Here

  @Override
  public Subject getSubjectInContext(String securityDomain) {
    SecurityContext sc = SecurityActions.getSecurityContext();
    if (sc != null && sc.getSecurityDomain().equals(securityDomain)) {
      SubjectInfo si = sc.getSubjectInfo();
      Subject subject = si.getAuthenticatedSubject();
      return subject;
    }   
    return null;
  }
View Full Code Here

  @Override
  public boolean sameSubject(String securityDomain, Object context, Subject subject) {
    Assertion.isNotNull(context);
    SecurityContext previousContext = (SecurityContext)context;
    Subject previousUser = previousContext.getSubjectInfo().getAuthenticatedSubject();
   
    SecurityContext currentContext = SecurityActions.getSecurityContext();
    if (currentContext != null && currentContext.getSecurityDomain().equals(securityDomain)) {
      Subject currentUser = currentContext.getSubjectInfo().getAuthenticatedSubject();
      if (previousUser.equals(currentUser)) {
        return true;
      }
    }
    return false;
View Full Code Here

      Principal p = Mockito.mock(Principal.class);
      Mockito.stub(p.getName()).toReturn("alreadylogged"); //$NON-NLS-1$
      HashSet<Principal> principals = new HashSet<Principal>();
      principals.add(p);
     
      Subject subject = new Subject(false, principals, new HashSet(), new HashSet());
      SecurityHelper sh = Mockito.mock(SecurityHelper.class);
      Mockito.stub(sh.getSubjectInContext("passthrough")).toReturn(subject); //$NON-NLS-1$
     
        TeiidLoginContext membershipService = new TeiidLoginContext(sh) {
      public LoginContext createLoginContext(String domain, CallbackHandler handler) throws LoginException {
View Full Code Here

    Model resultModel = ModelFactory.createDefaultModel();
    for (Source source : sources) {
      Resource sourceRes = resultModel.createResource(source.getURIRef());
      sourceRes.addProperty(RDF.type, METAMODEL.Source);
    }
    Subject subject = Subject.getSubject(AccessController.getContext());
    Set<GVSPrincipal> gvsPrincipals = subject.getPrincipals(GVSPrincipal.class);
    for (GVSPrincipal principal : gvsPrincipals) {
      resultModel.add(org.wymiwyg.commons.jena.JenaUtil.getExpandedResource(principal.getUserResource(), 2));
    }
    response.setBody(JenaUtil.getGraphFromModel(resultModel, true));
  }
View Full Code Here

TOP

Related Classes of javax.security.auth.Subject

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.