Method description


@param subjectAware
552412
private void initializeSecurityManager(SubjectAwareDescriptor subjectAware)
  {
    String cfg = subjectAware.getConfiguration();

    if (cfg.length() > 0)
    {
      Factory<SecurityManager> factory = new IniSecurityManagerFactory(cfg);
      SecurityManager securityManager = factory.getInstance();

      SecurityUtils.setSecurityManager(securityManager);
    }

    String username = subjectAware.getUsername();

    if ((username != null) && (username.length() > 0))
    {
      UsernamePasswordToken token = new UsernamePasswordToken(username,
                                      subjectAware.getPassword());

      SecurityUtils.getSubject().login(token);
    }
  }
57708
@Override
    public void run() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        super.subjectRepository.createSubject(this.subject, new SubjectRepository.SubjectUseCase() {
            @Override
            public void onMissionAccomplished(final Subject subject) {
                CreateSubjectUseCaseImp.super.mainThread.post(new Runnable() {
                    @Override
                    public void run() {
                        callback.onMissionAccomplished(subject);
                    }
                });
            }

            @Override
            public void onError(final SubjectException subjectException) {
                CreateSubjectUseCaseImp.super.mainThread.post(new Runnable() {
                    @Override
                    public void run() {
                        callback.onError(subjectException);
                    }
                });
            }
        });
    }
1238419
public boolean addSubject(String subject) {
        try {
            return add(new Meta(Element.SUBJECT, subject));
		} catch (DocumentException de) {
            throw new ExceptionConverter(de);
        }
    }
445587
public List<Subject> setupSubjects(List<Map<URI, List<AttributeValue>>> subjs) {

        if (subjs == null || subjs.size() == 0) {
            return Collections.singletonList(new Subject(new ArrayList<Attribute>()));
        }

        List<Subject> subjects = new ArrayList<Subject>(subjs.size());
        // Go through each of the subjects
        for (Map<URI, List<AttributeValue>> s : subjs) {
            List<Attribute> attributes = new ArrayList<Attribute>();

            // Extract and create the attributes for this subject and add them
            // to the set
            for (URI uri : s.keySet()) {
                List<AttributeValue> attributeValues = s.get(uri);
                if (attributeValues != null && attributeValues.size() > 0) {
                    attributes.add(
                        new BasicAttribute(uri, attributeValues.get(0).getType(),
                            null, null, attributeValues));
                }
            }

            // Create a new subject and add the attributes for this subject
            subjects.add(new Subject(attributes));
        }

        return subjects;
    }
884875
private void handleSpecialization(final String localName, final String classAttr) {
        if (classAttr == null) {
        } else if (TOPIC_INDEXTERM.matches(classAttr)) {
            // add the element name to the indexterm specialization element
            // list if it does not already exist in that list.
            if (!indexTermSpecList.contains(localName)) {
                indexTermSpecList.add(localName);
            }
        } else if (INDEXING_D_INDEX_SEE_ALSO.matches(classAttr)) {
            // add the element name to the index-see-also specialization element
            // list if it does not already exist in that list.
            if (!indexSeeAlsoSpecList.contains(localName)) {
                indexSeeAlsoSpecList.add(localName);
            }
        } else if (INDEXING_D_INDEX_SEE.matches(classAttr)) {
            // add the element name to the index-see specialization element
            // list if it does not already exist in that list.
            if (!indexSeeSpecList.contains(localName)) {
                indexSeeSpecList.add(localName);
            }
        } else if (INDEXING_D_INDEX_SORT_AS.matches(classAttr)) {
            // add the element name to the index-sort-as specialization element
            // list if it does not already exist in that list.
            if (!indexSortAsSpecList.contains(localName)) {
                indexSortAsSpecList.add(localName);
            }
        } else if (TOPIC_TOPIC.matches(classAttr)) {
            //add the element name to the topic specialization element
            // list if it does not already exist in that list.
            if (!topicSpecList.contains(localName)) {
                topicSpecList.add(localName);
            }
        } else if (TOPIC_TITLE.matches(classAttr)) {
            //add the element name to the title specailization element list
            // if it does not exist in that list.
            if (!titleSpecList.contains(localName)) {
                titleSpecList.add(localName);
            }
        }
    }
752420
public AttributeStatement newAttributeStatement(final Subject subject,
                                                    final Map<String, Object> attributes,
                                                    final String attributeNamespace) {

        val attrStatement = newSamlObject(AttributeStatement.class);
        attrStatement.setSubject(subject);
        for (val e : attributes.entrySet()) {
            if (e.getValue() instanceof Collection<?> && ((Collection<?>) e.getValue()).isEmpty()) {
                LOGGER.info("Skipping attribute [{}] because it does not have any values.", e.getKey());
                continue;
            }
            val attribute = newSamlObject(Attribute.class);
            attribute.setAttributeName(e.getKey());

            if (StringUtils.isNotBlank(attributeNamespace)) {
                attribute.setAttributeNamespace(attributeNamespace);
            }

            addAttributeValuesToSaml1Attribute(e.getKey(), e.getValue(), attribute.getAttributeValues());
            attrStatement.getAttributes().add(attribute);
        }

        return attrStatement;
    }
1290742
public void update(String subjectName, Object data)
   {
         Debugger.println(this,"Recieve subject="+subjectName);
         
         if(isStart(subjectName))
         {          
            this.startData = data;
            this.startDate = LocalDateTime.now();
            Debugger.printInfo(this,"TIMER START DATE ["+Text.formatDate(startDate)+"]\n "+Text.toString(startData));
            
         }
         else if(isEnd(subjectName))
         {            
            this.endData = data;
            this.endDate = LocalDateTime.now();
            
            Debugger.printInfo(this,"TIMER END DATE ["+endDate+"]\n "+endData);
            
            if(this.decorator != null)
               decorator.decorator(this);
         }   
         else
         {
            throw new SystemException("Unknown subject "+subjectName);
         }
   }
1137514
public static void executeWithSystemPermissions(Runnable task) {
        ContextAwareRunnable contextAwaretask = new ContextAwareRunnable(task);
        Subject newsubject = new Subject.Builder().buildSubject();
        newsubject.login(new RootAuthenticationToken());
        try {
            newsubject.execute(contextAwaretask);
        } finally {
            newsubject.logout();
        }
    }
1235935
private static SubjectAware findInternal(boolean recursive,
    Annotation... annotations)
  {
    SubjectAware subjectAware = null;

    for (Annotation annotation : annotations)
    {
      if (annotation.annotationType().isAssignableFrom(SubjectAware.class))
      {
        subjectAware = (SubjectAware) annotation;

        break;
      }
    }

    if ((subjectAware == null) && recursive)
    {
      for (Annotation annotation : annotations)
      {
        subjectAware = findInternal(false,
          annotation.annotationType().getAnnotations());
      }
    }

    return subjectAware;
  }
305450
@Override
    public void run() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        subjectRepository.getSubjectsCollection(new SubjectRepository.SubjectListCallback() {
            @Override
            public void onSubjectListLoader(final Collection<Subject> subjects) {
                mainThread.post(new Runnable() {
                    @Override
                    public void run() {
                        callback.onSubjectListLoaded(subjects);
                    }
                });
            }

            @Override
            public void onError(final SubjectException exception) {
                mainThread.post(new Runnable() {
                    @Override
                    public void run() {
                        callback.onError(exception);
                        Log.i(getClass().toString(), "Error!");
                    }
                });
            }
        });
    }
952907
@Override
	// @FFDCIgnore(Exception.class)
	public Subject handleJwtSSOTokenValidation(Subject subject, String encodedjwt) throws WSLoginFailedException {
		// TODO Auto-generated method stub		
        String msg = Tr.formatMessage(tc, "JWTSSO_CONFIG_INVALID_OR_TOKEN_INVALID", new Object[] {});		
		Subject resultSub = null;

		JwtSsoTokenUtils tokenUtil = getJwtSsoTokenConsumerUtils();
		if (tokenUtil != null && encodedjwt != null) {
			if (subject != null) {
				try {
					resultSub = tokenUtil.handleJwtSsoTokenValidationWithSubject(subject, encodedjwt);
				} catch (Exception e) {
					throw new WSLoginFailedException(e.getLocalizedMessage());
				}
			} else {
				try {
					resultSub = tokenUtil.handleJwtSsoTokenValidation(encodedjwt);
				} catch (Exception e) {
					throw new WSLoginFailedException(e.getLocalizedMessage());
				}
			}
		} else {
			throw new WSLoginFailedException(msg);
		}

		if (resultSub == null) {
			throw new WSLoginFailedException(msg);
		}

		return resultSub;
	}
840574
public static GSSCredential getGSSCredentialFromSubject(final Subject subject) {
        if (subject == null) {
            return null;
        }
        GSSCredential gssCredential = AccessController.doPrivileged(new PrivilegedAction<GSSCredential>() {
            @Override
            public GSSCredential run() {
                GSSCredential gssCredInSubject = null;
                Set<GSSCredential> privCredentials = subject.getPrivateCredentials(GSSCredential.class);
                if (privCredentials != null) {
                    Iterator<GSSCredential> privCredItr = privCredentials.iterator();
                    if (privCredItr.hasNext()) {
                        gssCredInSubject = privCredItr.next();
                    }
                }
                return gssCredInSubject;
            }
        });

        if (gssCredential == null) {
            KerberosTicket tgt = getKerberosTicketFromSubject(subject, null);
            if (tgt != null) {
                gssCredential = createGSSCredential(subject, tgt);
            }
        }

        return gssCredential;
    }
909502
private boolean setUnauthenticatedSubjectIfNeeded(Subject invokedSubject, Subject receivedSubject) {
        if ((invokedSubject == null) && (receivedSubject == null)) {
            // create the unauthenticated subject and set as the invocation subject
            subjectManager.setInvocationSubject(unauthenticatedSubjectServiceRef.getService().getUnauthenticatedSubject());
            return true;
        }
        return false;
    }
380514
@Override
	public void setSubject(String subject, java.util.Locale locale) {
		_commerceNotificationTemplate.setSubject(subject, locale);
	}
1258922
private void doHandleAs(Subject subject, final HttpExchange pHttpExchange) {
        try {
            Subject.doAs(subject, new PrivilegedExceptionAction<Void>() {
            public Void run() throws IOException {
                doHandle(pHttpExchange);
                return null;
            }
            });
        } catch (PrivilegedActionException e) {
            throw new SecurityException("Security exception: " + e.getCause(),e.getCause());
        }
    }
774251
public void logout(Subject subject) {
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
			SibTr.entry(tc, CLASS_NAME + "logout");
		}
		if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
			SibTr.exit(tc, CLASS_NAME + "logout");
		}
	}
121141
@Override
    public void setCredential(Subject subject) throws CredentialException {
        Set<WSPrincipal> principals = subject.getPrincipals(WSPrincipal.class);
        if (principals.isEmpty()) {
            return;
        }
        if (principals.size() != 1) {
            throw new CredentialException("Too many WSPrincipals in the subject");
        }
        WSPrincipal principal = principals.iterator().next();
        setCredential(subject, principal);
    }