Exemple #1
0
 def test_wsse_username_nonce(self):
     security = Security()
     token = UsernameToken("username", "password")
     token.setnonce()
     token.setcreated()
     token.setnonceencoding(True)
     token.setpassworddigest("digest")
     security.tokens.append(token)
     assert "<wsu:Created" in str(security.xml())
Exemple #2
0
def create_tokens(response):
    security = Security()
    token = UsernameToken(AUTHORIZED_NUI)
    token.setcreated(response.Fecha)
    token.nonce_has_encoding = True
    token.setnonce(response.Nonce)
    token.setpassworddigest(response.Digest)
    security.tokens.append(token)

    token_ts = Timestamp()
    token_ts.created = response.Fecha
    token_ts.expires = response.FechaF
    security.tokens.append(token_ts)
    return security
Exemple #3
0
def add_tokens(response, student_identity):
    """
    Agregar token de seguridad y de tiempo
    en header de WS
    """
    security = Security()
    token = UsernameToken(settings.WS_CONFIG['identity'])
    token.setcreated(response.Fecha)
    token.nonce_has_encoding = True
    token.setnonce(response.Nonce)
    token.setpassworddigest(response.Digest)
    security.tokens.append(token)
    token_ts = Timestamp()
    token_ts.created = response.Fecha
    token_ts.expires = response.FechaF
    security.tokens.append(token_ts)
    return security