Ejemplo n.º 1
0
    virtual void copyTo(ISecUser& destination)
    {
        destination.setAuthenticateStatus(getAuthenticateStatus());
        destination.setName(getName());
        destination.setFullName(getFullName());
        destination.setFirstName(getFirstName());
        destination.setLastName(getLastName());
        destination.setEmployeeID(getEmployeeID());
        destination.setRealm(getRealm());
        destination.setFqdn(getFqdn());
        destination.setPeer(getPeer());
        destination.credentials().setPassword(credentials().getPassword());
        destination.credentials().setSessionToken(credentials().getSessionToken());
        destination.credentials().setSignature(credentials().getSignature());
        CDateTime exp;
        credentials().getPasswordExpiration(exp);
        destination.credentials().setPasswordExpiration(exp);
        CDateTime tmpTime;
        destination.setPasswordExpiration(getPasswordExpiration(tmpTime));
        destination.setStatus(getStatus());
        CriticalBlock b(crit);
        Owned<IPropertyIterator> Itr = m_parameters->getIterator();
        ForEach(*Itr)
        {
            destination.setProperty(Itr->getPropKey(),m_parameters->queryProp(Itr->getPropKey()));
        }


//      DBGLOG("Copied name %s to %s",getName(),destination.getName());
    }
Ejemplo n.º 2
0
    virtual void copyTo(ISecUser& destination)
    {
        destination.setAuthenticateStatus(getAuthenticateStatus());
        destination.setName(getName());
        destination.setFullName(getFullName());
        destination.setFirstName(getFirstName());
        destination.setLastName(getLastName());
        destination.setRealm(getRealm());
        destination.setFqdn(getFqdn());
        destination.setPeer(getPeer());
        destination.credentials().setPassword(credentials().getPassword());
        CDateTime tmpTime;
        destination.setPasswordExpiration(getPasswordExpiration(tmpTime));
        destination.setStatus(getStatus());
        if(m_parameters.get()==NULL)
            return;
        CriticalBlock b(crit);
        Owned<IPropertyIterator> Itr = m_parameters->getIterator();
        Itr->first();
        while(Itr->isValid())
        {
            destination.setProperty(Itr->getPropKey(),m_parameters->queryProp(Itr->getPropKey()));
            Itr->next();
        }


        //addToken is not currently implemented....
//      DBGLOG("Copied name %s to %s",getName(),destination.getName());
    }
Ejemplo n.º 3
0
/**
 *  Retrieve the GPSEE Realm data structure for the supplied context.
 *
 *  @param      cx      A context in the GPSEE Realm
 *  @returns    The realm, or NULL if we've thrown an exception.
 *
 *  @note       This function is more pedantic in DEBUG builds than
 *              RELEASE builds. In DEBUG we find what we <i>should</i>,
 *              in RELEASE we find what we <i>can</i>.
 */
gpsee_realm_t *gpsee_getRealm(JSContext *cx)
{
  gpsee_realm_t *realm = getRealm(cx);

  GPSEE_ASSERT(realm);

  if (!realm)
  {
    (void)gpsee_throw(cx, GPSEE_GLOBAL_NAMESPACE_NAME ".getRealm: Could not identify GPSEE Realm.");
    return NULL;
  }

  return realm;
}       
Ejemplo n.º 4
0
void CLdapSecUser::copyTo(ISecUser& destination)
{
    CLdapSecUser* dest = dynamic_cast<CLdapSecUser*>(&destination);
    if(!dest)
        return;

    dest->setAuthenticated(isAuthenticated());
    dest->setName(getName());
    dest->setFullName(getFullName());
    dest->setFirstName(getFirstName());
    dest->setLastName(getLastName());
    dest->setRealm(getRealm());
    dest->credentials().setPassword(credentials().getPassword());
    dest->setUserSid(m_usersid.length(), m_usersid.toByteArray());
    dest->setUserID(m_userid);
    dest->setPasswordExpiration(m_passwordExpiration);
}
Ejemplo n.º 5
0
std::string AuthScope::toString() const
{
    std::stringstream ss;

    ss << "Scheme: " << (_hasScheme ? getScheme() : "Any");
    ss << " Host: " << (_hasHost ? getHost() : "Any");
    ss << " Port: ";
    if (_hasPort)
    {
        ss << getPort();
    }
    else
    {
        ss << "Any";
    }

    ss << " Realm: " << (_hasRealm ? getRealm() : "Any");
    ss << " AuthType: ";

    if (_hasAuthType)
    {
        switch (getAuthType())
        {
            case BASIC:
                ss << "BASIC";
                break;
            case DIGEST:
                ss << "DIGEST";
                break;
            case NONE:
                ss << "NONE";
                break;
            default:
                ss << "UNKNOWN";
        }
    }
    else
    {
        ss << "Any";
    }
    
    return ss.str();
}
Ejemplo n.º 6
0
void CLdapSecUser::copyTo(ISecUser& destination)
{
    if (this == &destination)
        return;

    CLdapSecUser* dest = dynamic_cast<CLdapSecUser*>(&destination);
    if(!dest)
        return;

    dest->setAuthenticateStatus(getAuthenticateStatus());
    dest->setName(getName());
    dest->setFullName(getFullName());
    dest->setFirstName(getFirstName());
    dest->setLastName(getLastName());
    dest->setEmployeeID(getEmployeeID());
    dest->setRealm(getRealm());
    dest->credentials().setPassword(credentials().getPassword());
    dest->setUserSid(m_usersid.length(), m_usersid.toByteArray());
    dest->setUserID(m_userid);
    dest->setPasswordExpiration(m_passwordExpiration);
    dest->setDistinguishedName(m_distinguishedName);
    dest->credentials().setSessionToken(&m_sessionToken);
    dest->credentials().setSignature(&m_signature);
}
Ejemplo n.º 7
0
int
loginCocologFiles( const char *username,    // (I) ユーザ名
                   const char *password,    // (I) パスワード
                   char       *cookie )     // (O) クッキー
{
    int     ret = 0;
    char    *p;
    char    *request;
    char    *response;
    char    url[MAX_URLLENGTH_MAX];
    char    realm[MAX_KEYLENGTH * 2];
    char    digest[BUFSIZ];
    size_t  sz = MAX_CONTENT_SIZE;

    if ( !cookie )
         return ( ret );

    if ( !username )
        username = xmlrpc_p->userName;
    if ( !password )
        password = xmlrpc_p->password;

    request  = (char *)malloc( MAX_CONTENT_SIZE );
    if ( !request ) 
        return ( ret );
    response = (char *)malloc( sz );
    if ( !response ) {
        free( request );
        return ( ret );
    }
    memset( request, 0x00, MAX_CONTENT_SIZE );

    strcpy( url, 
            xmlrpc_p->blogKind == BLOGKIND_COCOLOGFREE
                ? COCOLOGFREE_APP
                : COCOLOG_APP );
    setUpReceiveBuffer( response, sz );
    http_getEx( url, response, cookie );
    if ( *response )
        getCurrentLocation( url );

    realm[0] = NUL;
    getRealm( request, response, sz, cookie, realm );
    if ( realm[0] ) {
        sprintf( digest, "%s:%s:%s", username, realm, password );
        p = MD5( digest );
        if ( p ) {
            strcpy( digest, p );
            sprintf( request,
                     "username=%s&"
                     "digest=%s&"
                     "remember=1&"
                     "submit=%s",
                     username,
                     digest,
                     encodeURL(sjis2utf("ログイン")) );
            setUpReceiveBuffer( response, sz );
            http_postEx( url,
                         "application/x-www-form-urlencoded",
                         request, response, cookie );
            if ( *cookie && strstr( cookie, "SSOID=" ) )
                ret = 1;    /* ログイン成功 */
            else {
                ret = 0;    /* ログイン失敗 */
                if ( xmlrpc_p->verbose )
                    dputs( "loginCocologFiles: login失敗\n" );
            }
        }
    }

    encodeURL( NULL );
    free( response );
    free( request  );

    return ( ret );
}