'Override __setitem__ to prevent conflicting values.'

def __setitem__(self, key, val):

    if ((key in self.IDENTITY_ATTRIBUTES) and (key in self)):
        existing_val = self[key]
        if (key == 'expires_at'):
            if (existing_val != val):
                LOG.info('"expires_at"    has    conflicting    values    %(existing)s    and    %(new)s.        Will    use    the    earliest    value.', {'existing': existing_val, 'new': val})
            if ((existing_val is None) or (val is None)):
                val = (existing_val or val)
            else:
                val = min(existing_val, val)
        elif (existing_val != val):
            msg = (_('Unable    to    reconcile    identity    attribute    %(attribute)s    as    it    has    conflicting    values    %(new)s    and    %(old)s') % {'attribute': key, 'new': val, 'old': existing_val})
            raise exception.Unauthorized(msg)
    return super(AuthContext, self).__setitem__(key, val)
