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
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