Examples of CredentialsToken


Examples of org.apache.slide.authenticate.CredentialsToken

    public static void removeLock(NamespaceAccessToken nat,
                                  String caller,
                                  String uri,
                                  String lockId) throws Exception {
       
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Lock lock = nat.getLockHelper();
       
        try {
            nat.begin();
            lock.unlock(slideToken,uri,lockId);
View Full Code Here

Examples of org.apache.slide.authenticate.CredentialsToken

      
       // expiration in minutes
       int intExpiration = Integer.valueOf(expiration).intValue();
       Date expire = new Date(System.currentTimeMillis() + intExpiration*1000*60);
      
       SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
       Lock lock = nat.getLockHelper();
      
       try {
           nat.begin();
           lock.lock(slideToken,new NodeLock(uri,subject,type,expire,isExclusive,isInherit));
View Full Code Here

Examples of org.apache.slide.authenticate.CredentialsToken

  * @param user reference
  * @return a Slide toke object
  */
  private SlideToken getSlideToken (String userNode)
  {
    CredentialsToken credToken = new CredentialsToken(new String(userNode));

    return new SlideTokenImpl(credToken);
  }
View Full Code Here

Examples of org.apache.slide.authenticate.CredentialsToken

     * @return a new SlideToken instance
     **/
    public static SlideToken getSlideToken
        (HttpServletRequest req) {
       
        CredentialsToken credentialsToken;
        Principal principal = req.getUserPrincipal();
        HttpSession session = req.getSession();
       
        // store the current principal in the session, to get around a bug in
        // IE 5 where the authentication info is not submitted by IE when
        // doing a HEAD request.
        if (principal == null) {
            final String credentials = (String) session.getAttribute(CREDENTIALS_ATTRIBUTE);
            credentialsToken = new CredentialsToken(credentials == null ? "" : credentials);
        } else {
            // because the principal is not guaranteed to be serializable
            // and could thus create problems in a distributed deployment
            // we store the principal name instead of the principal itself
            session.setAttribute(CREDENTIALS_ATTRIBUTE, principal.getName());
            credentialsToken = new CredentialsToken(principal);
        }
       
        SlideToken token = new SlideTokenImpl(credentialsToken);
        token.setEnforceLockTokens(true);

View Full Code Here

Examples of org.apache.slide.authenticate.CredentialsToken

                        nat.begin();
                        Iterator keys = information.keySet().iterator();
                        while (keys.hasNext()) {
                            String key = keys.next().toString();
                            if ("uri".equals(key)) {
                                Uri theUri = nat.getUri(new SlideTokenImpl(new CredentialsToken("")), stripUri(information.get(key).toString()));
                                Store store = theUri.getStore();
                                if (store instanceof ExtendedStore) {
                                    Domain.log("Resetting cache for " + theUri, LOG_CHANNEL, Logger.INFO);
                                    ((ExtendedStore) store).removeObjectFromCache(theUri);
                                }
                            }
                        }
                        nat.commit();
                    } catch(Exception e) {
                      if (Domain.isEnabled(LOG_CHANNEL, Logger.ERROR)) {
                        Domain.log("Error clearing cache: " + e + ". See stderr for stacktrace.", LOG_CHANNEL, Logger.ERROR);
                        e.printStackTrace();
                      }
                    }
                }
            };

            final Subscriber structureSubscriber = new Subscriber() {
                public void notify(String uri, Map information) {
                    NamespaceAccessToken nat = Domain.accessNamespace(new SecurityToken(this), Domain.getDefaultNamespace());
                    try {
                        nat.begin();
                      Iterator keys = information.keySet().iterator();
                      while (keys.hasNext()) {
                          String key = keys.next().toString();
                          if ("uri".equals(key)) {
                              Uri theUri = nat.getUri(new SlideTokenImpl(new CredentialsToken("")), stripUri(information.get(key).toString()));
                              Store store = theUri.getParentUri().getStore();
                              if (store instanceof ExtendedStore) {
                                  Domain.log("Resetting cache for " + theUri.getParentUri(), LOG_CHANNEL, Logger.INFO);
                                  ((ExtendedStore) store).removeObjectFromCache(theUri.getParentUri());
                              }
View Full Code Here

Examples of org.apache.slide.authenticate.CredentialsToken

        m_manager = manager;
    }

    public void initialize() throws SourceException {
       
        CredentialsToken credentials = new CredentialsToken(m_principal);
        m_slideToken = new SlideTokenImpl(credentials);
       
        m_structure = m_nat.getStructureHelper();
        m_content = m_nat.getContentHelper();
        m_lock = m_nat.getLockHelper();
View Full Code Here

Examples of org.apache.slide.authenticate.CredentialsToken

                               String password) throws Exception {
       
        String usersPath = nat.getNamespaceConfig().getUsersPath();
        String userUri = usersPath + "/" + username;
       
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Structure structure = nat.getStructureHelper();
        Content content = nat.getContentHelper();
       
        try {
           
View Full Code Here

Examples of org.apache.slide.authenticate.CredentialsToken

                                String groupname) throws Exception {
       
        String groupsPath = nat.getNamespaceConfig().getGroupsPath();
        String groupUri = groupsPath + "/" + groupname;
       
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Structure structure = nat.getStructureHelper();
        Content content = nat.getContentHelper();
       
        try {
            nat.begin();
View Full Code Here

Examples of org.apache.slide.authenticate.CredentialsToken

                                String rolename) throws Exception {
       
        String rolesPath = nat.getNamespaceConfig().getRolesPath();
        String roleUri = rolesPath + "/" + rolename;
       
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Structure structure = nat.getStructureHelper();
        Content content = nat.getContentHelper();
       
        try {
            nat.begin();
View Full Code Here

Examples of org.apache.slide.authenticate.CredentialsToken

        // user cannot delete itself
        if (callerUri.equals(objectUri)) {
            return;
        }
   
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Macro macro = nat.getMacroHelper();
   
        try {
            nat.begin();
   
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.